If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Search & Replace
I just tried searching for " face^10", "face ^10", and " ^10" in W2009. All
work with wild cards enabled. It selects only up to the end of cell marker—probably because the marker cannot be manipulated. It also replaces only up to the end of cell marker. Thanks, Paul. Pam macropod wrote: Hi Dean, Works fine in Word 2000. It seems to be just another thing that took a backward step with later versions ... Sorry, to clarify. ^10 does work but not on its own or with a space before. [quoted text clipped - 20 lines] What are the equivalent codes when using Search & Replace in tables? . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/201001/1 |
#12
|
|||
|
|||
Search & Replace
It also works with " {1,}^10. I too have had to delete trailing spaces from
dozens of tables and hundreds of cells—by hand. So this could be a big help. Pam Pamelia Caswell wrote: I just tried searching for " face^10", "face ^10", and " ^10" in W2009. All work with wild cards enabled. It selects only up to the end of cell marker—probably because the marker cannot be manipulated. It also replaces only up to the end of cell marker. Thanks, Paul. Pam Hi Dean, [quoted text clipped - 5 lines] What are the equivalent codes when using Search & Replace in tables? . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/201001/1 |
#13
|
|||
|
|||
Search & Replace
Hi Pamela.
Unfortuantely, this still does not work, it finds any space in the table, not just a space next to the Cell End Marker, which is what is required. Oh well never mind. Thanks anyway. DeanH "Pamelia Caswell via OfficeKB.com" wrote: It also works with " {1,}^10. I too have had to delete trailing spaces from dozens of tables and hundreds of cells—by hand. So this could be a big help. Pam Pamelia Caswell wrote: I just tried searching for " face^10", "face ^10", and " ^10" in W2009. All work with wild cards enabled. It selects only up to the end of cell marker—probably because the marker cannot be manipulated. It also replaces only up to the end of cell marker. Thanks, Paul. Pam Hi Dean, [quoted text clipped - 5 lines] What are the equivalent codes when using Search & Replace in tables? . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ables/201001/1 . |
#14
|
|||
|
|||
Search & Replace
Hello Graham.
Many thanks for these two macros. Unfortunately both fail at: Set oRng = .Cell(I, j).Range Any ideas? DeanH "Graham Mayor" wrote: To process all the tables change that to Dim oRng As Range Dim oTable As Table For Each oTable In ActiveDocument.Tables With oTable For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Graham Mayor" wrote in message ... The following macro will clear trailing spaces from all the cells in the table containing the cursor Dim oRng As Range With Selection.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With If you want to clear leading and trailing spaces change RTrim for Trim Note that if you select the table and Click CTRL+E then CTRL+L all leading and trailing white space will be cleared from the table. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... Hi Graham, Apologies; I expressed myself incorrectly. I am not referring to paragraph breaks (¶) in table cell, but to the actual cell marker (¤). I have several documents that contain tables with a space or spaces between the last character and the cell marker that I need to remove (quite laborious in a 100-page document riddled with tables). The ^10 suggested by DeanH does not do it either. I have tried a number of permutations, and frankly, some weird things happen. "Graham Mayor" wrote: Paragraph breaks are paragraph breaks wherever they are in the document. What *exactly* are you trying to do? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... In Search & Replace (Find & Replace) where paragraph signs are involved, one would use ^p in normal text or ^13 when using wild cards. What are the equivalent codes when using Search & Replace in tables? . . |
#15
|
|||
|
|||
Search & Replace
The thing that occurs is that you may have merged cells in your table. The
macros will not work with merged or split cells. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "DeanH" wrote in message ... Hello Graham. Many thanks for these two macros. Unfortunately both fail at: Set oRng = .Cell(I, j).Range Any ideas? DeanH "Graham Mayor" wrote: To process all the tables change that to Dim oRng As Range Dim oTable As Table For Each oTable In ActiveDocument.Tables With oTable For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Graham Mayor" wrote in message ... The following macro will clear trailing spaces from all the cells in the table containing the cursor Dim oRng As Range With Selection.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With If you want to clear leading and trailing spaces change RTrim for Trim Note that if you select the table and Click CTRL+E then CTRL+L all leading and trailing white space will be cleared from the table. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... Hi Graham, Apologies; I expressed myself incorrectly. I am not referring to paragraph breaks (¶) in table cell, but to the actual cell marker (¤). I have several documents that contain tables with a space or spaces between the last character and the cell marker that I need to remove (quite laborious in a 100-page document riddled with tables). The ^10 suggested by DeanH does not do it either. I have tried a number of permutations, and frankly, some weird things happen. "Graham Mayor" wrote: Paragraph breaks are paragraph breaks wherever they are in the document. What *exactly* are you trying to do? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... In Search & Replace (Find & Replace) where paragraph signs are involved, one would use ^p in normal text or ^13 when using wild cards. What are the equivalent codes when using Search & Replace in tables? . . |
#16
|
|||
|
|||
Search & Replace
Graham, yep that was it, two cells in the header row were merged in the test
table. Many thanks DeanH "Graham Mayor" wrote: The thing that occurs is that you may have merged cells in your table. The macros will not work with merged or split cells. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "DeanH" wrote in message ... Hello Graham. Many thanks for these two macros. Unfortunately both fail at: Set oRng = .Cell(I, j).Range Any ideas? DeanH "Graham Mayor" wrote: To process all the tables change that to Dim oRng As Range Dim oTable As Table For Each oTable In ActiveDocument.Tables With oTable For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Graham Mayor" wrote in message ... The following macro will clear trailing spaces from all the cells in the table containing the cursor Dim oRng As Range With Selection.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With If you want to clear leading and trailing spaces change RTrim for Trim Note that if you select the table and Click CTRL+E then CTRL+L all leading and trailing white space will be cleared from the table. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... Hi Graham, Apologies; I expressed myself incorrectly. I am not referring to paragraph breaks (¶) in table cell, but to the actual cell marker (¤). I have several documents that contain tables with a space or spaces between the last character and the cell marker that I need to remove (quite laborious in a 100-page document riddled with tables). The ^10 suggested by DeanH does not do it either. I have tried a number of permutations, and frankly, some weird things happen. "Graham Mayor" wrote: Paragraph breaks are paragraph breaks wherever they are in the document. What *exactly* are you trying to do? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... In Search & Replace (Find & Replace) where paragraph signs are involved, one would use ^p in normal text or ^13 when using wild cards. What are the equivalent codes when using Search & Replace in tables? . . . |
#17
|
|||
|
|||
Search & Replace
Note that you can step through all of the cells of a table that contains
merged cells by using Dim acell As Cell For Each acell In ActiveDocument.Tables(1).Range.Cells 'Do something with each cell Next acell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "DeanH" wrote in message ... Graham, yep that was it, two cells in the header row were merged in the test table. Many thanks DeanH "Graham Mayor" wrote: The thing that occurs is that you may have merged cells in your table. The macros will not work with merged or split cells. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "DeanH" wrote in message ... Hello Graham. Many thanks for these two macros. Unfortunately both fail at: Set oRng = .Cell(I, j).Range Any ideas? DeanH "Graham Mayor" wrote: To process all the tables change that to Dim oRng As Range Dim oTable As Table For Each oTable In ActiveDocument.Tables With oTable For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Graham Mayor" wrote in message ... The following macro will clear trailing spaces from all the cells in the table containing the cursor Dim oRng As Range With Selection.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With If you want to clear leading and trailing spaces change RTrim for Trim Note that if you select the table and Click CTRL+E then CTRL+L all leading and trailing white space will be cleared from the table. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... Hi Graham, Apologies; I expressed myself incorrectly. I am not referring to paragraph breaks (¶) in table cell, but to the actual cell marker (¤). I have several documents that contain tables with a space or spaces between the last character and the cell marker that I need to remove (quite laborious in a 100-page document riddled with tables). The ^10 suggested by DeanH does not do it either. I have tried a number of permutations, and frankly, some weird things happen. "Graham Mayor" wrote: Paragraph breaks are paragraph breaks wherever they are in the document. What *exactly* are you trying to do? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... In Search & Replace (Find & Replace) where paragraph signs are involved, one would use ^p in normal text or ^13 when using wild cards. What are the equivalent codes when using Search & Replace in tables? . . . |
#18
|
|||
|
|||
Search & Replace
Good thinking - that would equate to
Dim oRng As Range Dim oTable As Table Dim acell As Cell For Each oTable In ActiveDocument.Tables With oTable For Each acell In oTable.Range.Cells Set oRng = acell.Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next acell End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Doug Robbins - Word MVP" wrote in message ... Note that you can step through all of the cells of a table that contains merged cells by using Dim acell As Cell For Each acell In ActiveDocument.Tables(1).Range.Cells 'Do something with each cell Next acell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "DeanH" wrote in message ... Graham, yep that was it, two cells in the header row were merged in the test table. Many thanks DeanH "Graham Mayor" wrote: The thing that occurs is that you may have merged cells in your table. The macros will not work with merged or split cells. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "DeanH" wrote in message ... Hello Graham. Many thanks for these two macros. Unfortunately both fail at: Set oRng = .Cell(I, j).Range Any ideas? DeanH "Graham Mayor" wrote: To process all the tables change that to Dim oRng As Range Dim oTable As Table For Each oTable In ActiveDocument.Tables With oTable For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Graham Mayor" wrote in message ... The following macro will clear trailing spaces from all the cells in the table containing the cursor Dim oRng As Range With Selection.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With If you want to clear leading and trailing spaces change RTrim for Trim Note that if you select the table and Click CTRL+E then CTRL+L all leading and trailing white space will be cleared from the table. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... Hi Graham, Apologies; I expressed myself incorrectly. I am not referring to paragraph breaks (¶) in table cell, but to the actual cell marker (¤). I have several documents that contain tables with a space or spaces between the last character and the cell marker that I need to remove (quite laborious in a 100-page document riddled with tables). The ^10 suggested by DeanH does not do it either. I have tried a number of permutations, and frankly, some weird things happen. "Graham Mayor" wrote: Paragraph breaks are paragraph breaks wherever they are in the document. What *exactly* are you trying to do? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... In Search & Replace (Find & Replace) where paragraph signs are involved, one would use ^p in normal text or ^13 when using wild cards. What are the equivalent codes when using Search & Replace in tables? . . . |
#19
|
|||
|
|||
Search & Replace
So then, it would appear as though there is no "one size fits all" solution.
Many thanks to all contributors! "Doug Robbins - Word MVP" wrote: Note that you can step through all of the cells of a table that contains merged cells by using Dim acell As Cell For Each acell In ActiveDocument.Tables(1).Range.Cells 'Do something with each cell Next acell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "DeanH" wrote in message ... Graham, yep that was it, two cells in the header row were merged in the test table. Many thanks DeanH "Graham Mayor" wrote: The thing that occurs is that you may have merged cells in your table. The macros will not work with merged or split cells. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "DeanH" wrote in message ... Hello Graham. Many thanks for these two macros. Unfortunately both fail at: Set oRng = .Cell(I, j).Range Any ideas? DeanH "Graham Mayor" wrote: To process all the tables change that to Dim oRng As Range Dim oTable As Table For Each oTable In ActiveDocument.Tables With oTable For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Graham Mayor" wrote in message ... The following macro will clear trailing spaces from all the cells in the table containing the cursor Dim oRng As Range With Selection.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With If you want to clear leading and trailing spaces change RTrim for Trim Note that if you select the table and Click CTRL+E then CTRL+L all leading and trailing white space will be cleared from the table. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... Hi Graham, Apologies; I expressed myself incorrectly. I am not referring to paragraph breaks (¶) in table cell, but to the actual cell marker (¤). I have several documents that contain tables with a space or spaces between the last character and the cell marker that I need to remove (quite laborious in a 100-page document riddled with tables). The ^10 suggested by DeanH does not do it either. I have tried a number of permutations, and frankly, some weird things happen. "Graham Mayor" wrote: Paragraph breaks are paragraph breaks wherever they are in the document. What *exactly* are you trying to do? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... In Search & Replace (Find & Replace) where paragraph signs are involved, one would use ^p in normal text or ^13 when using wild cards. What are the equivalent codes when using Search & Replace in tables? . . . |
#20
|
|||
|
|||
Search & Replace
I believe that the code posted by Graham will work for all of the "sizes"
mentioned. What other "sizes" were you thinking about. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Johann Swart" wrote in message ... So then, it would appear as though there is no "one size fits all" solution. Many thanks to all contributors! "Doug Robbins - Word MVP" wrote: Note that you can step through all of the cells of a table that contains merged cells by using Dim acell As Cell For Each acell In ActiveDocument.Tables(1).Range.Cells 'Do something with each cell Next acell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "DeanH" wrote in message ... Graham, yep that was it, two cells in the header row were merged in the test table. Many thanks DeanH "Graham Mayor" wrote: The thing that occurs is that you may have merged cells in your table. The macros will not work with merged or split cells. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "DeanH" wrote in message ... Hello Graham. Many thanks for these two macros. Unfortunately both fail at: Set oRng = .Cell(I, j).Range Any ideas? DeanH "Graham Mayor" wrote: To process all the tables change that to Dim oRng As Range Dim oTable As Table For Each oTable In ActiveDocument.Tables With oTable For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With Next oTable -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Graham Mayor" wrote in message ... The following macro will clear trailing spaces from all the cells in the table containing the cursor Dim oRng As Range With Selection.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count Set oRng = .Cell(i, j).Range oRng.End = oRng.End - 1 oRng.Text = RTrim(oRng.Text) Next j Next i End With If you want to clear leading and trailing spaces change RTrim for Trim Note that if you select the table and Click CTRL+E then CTRL+L all leading and trailing white space will be cleared from the table. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... Hi Graham, Apologies; I expressed myself incorrectly. I am not referring to paragraph breaks (¶) in table cell, but to the actual cell marker (¤). I have several documents that contain tables with a space or spaces between the last character and the cell marker that I need to remove (quite laborious in a 100-page document riddled with tables). The ^10 suggested by DeanH does not do it either. I have tried a number of permutations, and frankly, some weird things happen. "Graham Mayor" wrote: Paragraph breaks are paragraph breaks wherever they are in the document. What *exactly* are you trying to do? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Johann Swart" wrote in message ... In Search & Replace (Find & Replace) where paragraph signs are involved, one would use ^p in normal text or ^13 when using wild cards. What are the equivalent codes when using Search & Replace in tables? . . . |
Thread Tools | |
Display Modes | |
|
|