Word Macro to insert rows to multiple tables
Closed
such
-
16 May 2011 à 14:44
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 24 May 2011 à 10:26
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 24 May 2011 à 10:26
Related:
- Word Macro to insert rows to multiple tables
- Insert check mark in word - Guide
- How to delete a row in a table in word - Guide
- Ms word pdf extension - Download - Other
- Insert key on keyboard - Guide
- How to insert picture in word document without moving text - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
24 May 2011 à 10:26
24 May 2011 à 10:26
In word 2007, when I inserted a table and ran your code. this is what I found
the cell that contain "Procedure" also comes up with baggage. There are two extra non printable characters. So the match failed. In my case I had to make this change
the cell that contain "Procedure" also comes up with baggage. There are two extra non printable characters. So the match failed. In my case I had to make this change
Sub copyn()
'macro to copy rows to multiple tables
Dim tTable As Table
Dim TargetText As String
Dim oRow As Row
Dim v As Variant
TargetText = "Procedure"
For Each tTable In ActiveDocument.Tables
For Each oRow In tTable.Rows
v = oRow.Cells(1).Range.Text
v = Replace(v, Chr(13), vbNullString)
v = Replace(v, Chr(7), vbNullString)
If v = TargetText Then Selection.Paste
Next oRow
Next tTable
End Sub