S
Sonny Maou
I've got many pages of tables, which contain certain rows that I need
copied to a new document. I've got this far but can't get beyond getting
the rows "pasted" into the new doc. Can somebody point me straight?!
Thanks!![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
oDoc = ActiveDocument.Name
Documents.Add
pDoc = ActiveDocument.Name
For Each tbl In Documents(oDoc).Tables
For r = 10 To 20 'the rows I need from each table!
If r <> 13 And r <> 17 Then ' but skip these rows![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
hasData = False
nRow = ""
For c = 1 To 12
v = tbl.Cell(r, c).Range.Text
If Asc(v) <> 13 Then
hasData = True 'don't copy if devoid of text
End If
Next
If hasData Then 'idiot code below... need help!![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
tbl.Rows(r).Range.Select
Selection.Copy
Documents(pDoc).Range.Paste
End If
End If
Next
Next
copied to a new document. I've got this far but can't get beyond getting
the rows "pasted" into the new doc. Can somebody point me straight?!
Thanks!
oDoc = ActiveDocument.Name
Documents.Add
pDoc = ActiveDocument.Name
For Each tbl In Documents(oDoc).Tables
For r = 10 To 20 'the rows I need from each table!
If r <> 13 And r <> 17 Then ' but skip these rows
hasData = False
nRow = ""
For c = 1 To 12
v = tbl.Cell(r, c).Range.Text
If Asc(v) <> 13 Then
hasData = True 'don't copy if devoid of text
End If
Next
If hasData Then 'idiot code below... need help!
tbl.Rows(r).Range.Select
Selection.Copy
Documents(pDoc).Range.Paste
End If
End If
Next
Next