Help modifying "copying specific rows" code.
Greg wrote this code that is perfect for what I asked for and I'm super grateful. However I've come across a scenario where there is more than one table in my check list. I've tried changing the "Set oTbl = oDoc.Tables(1)" to (1,5), I've tried copying and pasting the same code 5 times and changing to "Set oTbl = oDoc.Tables(2)then (3)" and so on but I can't get it to work. Is there a way to get it recognize each of the tables no matter how many there are?
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oDoc As Document
Dim oTbl As Table
Dim oCell As Cell
ActiveDocument.Range.Copy
Set oDoc = Documents.Add
oDoc.Range.Paste
Set oTbl = oDoc.Tables(1)
For Each oCell In oTbl.Range.Cells
If oCell.Range.Information(wdEndOfRangeColumnNumber) = 4 Then
If oCell.Range.Information(wdEndOfRangeRowNumber) > 2 Then
If Left(oCell.Range, Len(oCell.Range) - 2) <> "N" And _
Left(oCell.Range, Len(oCell.Range) - 2) <> vbNullString Then
oCell.Select
Selection.Rows.Delete
End If
End If
End If
Next
lbl_Exit:
Exit Sub
End Sub