K
Krakmup
G'Day
Is it possible to reduce the lines of code for the followng, assuming I want
to find and delete rows in a table that contain "0", "-1", "-2", "-3" in
column 1.
CODE:
If Selection.Information(wdWithInTable) = False Then Exit Sub
TargetText = "0"
For Each oRow In Selection.Tables(1).Rows
If oRow.Cells(1).Range.Text = TargetText & vbCr & Chr(7) Then oRow.Delete
Next oRow
TargetText = "-1"
For Each oRow In Selection.Tables(1).Rows
If oRow.Cells(1).Range.Text = TargetText & vbCr & Chr(7) Then oRow.Delete
Next oRow
Repeating 4 lines of code seems like a waste of space.
Thanks
Krakmup
Is it possible to reduce the lines of code for the followng, assuming I want
to find and delete rows in a table that contain "0", "-1", "-2", "-3" in
column 1.
CODE:
If Selection.Information(wdWithInTable) = False Then Exit Sub
TargetText = "0"
For Each oRow In Selection.Tables(1).Rows
If oRow.Cells(1).Range.Text = TargetText & vbCr & Chr(7) Then oRow.Delete
Next oRow
TargetText = "-1"
For Each oRow In Selection.Tables(1).Rows
If oRow.Cells(1).Range.Text = TargetText & vbCr & Chr(7) Then oRow.Delete
Next oRow
Repeating 4 lines of code seems like a waste of space.
Thanks
Krakmup