![]() |
|
|
Thread Tools | Display Modes |
#9
|
||||
|
||||
![]()
The problem with what you recorded is that you simply keep deleting characters until you've deleted 17 of them. What you should have recorded is:
Code:
Sub Macro1() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "#" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend Selection.Delete End Sub Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend is what you get via Ctrl-Shift-RightArrow, which doesn't require you to know how many characters there are and, moreover, spans everything until the end of the line.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
delete text toright, macro, table cell |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
saandahn | Word Tables | 4 | 01-08-2018 09:27 AM |
How to delete unused cell remaining at end of a block of deleted data | SKEETER | Excel | 2 | 10-24-2017 07:06 AM |
How can I delete spaces & lines in a table cell | mrayncrental | Word VBA | 3 | 10-20-2014 07:09 PM |
![]() |
So New2 This | Word VBA | 1 | 05-06-2013 09:00 PM |
How can I delete the content of a cell in column if the cell value is more than 1000? | Learner7 | Excel | 2 | 06-27-2011 05:44 AM |