mmetzinger
Board Regular
- Joined
- Dec 30, 2010
- Messages
- 61
OK, so I have the following code:
which works great except for one issue. On the case else step when it deletes the row a problem is created with the loop in that the row that is after the row that is deleted moves up but the loop goes to the next row after it. All I need is a way to tell it that when it does the delete it also needs to step back one "oneCell" but i don't have a clue how to do this.
Any help would be greatly appreciated!
Code:
Dim oneCell As Range
Dim HeaderRange As String
Range("Z1").Select
Range(Selection, Selection.End(xlDown)).Select
HeaderRange = Selection.Address
For Each oneCell In Range(HeaderRange)
If oneCell.Value = "" Then
GoTo skip
End If
Select Case oneCell.Value
Case "Policy Status"
Case "PRMPY"
Case "Issued- Not Paid"
Case Else
oneCell.EntireRow.Delete
End Select
skip:
Next oneCell
which works great except for one issue. On the case else step when it deletes the row a problem is created with the loop in that the row that is after the row that is deleted moves up but the loop goes to the next row after it. All I need is a way to tell it that when it does the delete it also needs to step back one "oneCell" but i don't have a clue how to do this.
Any help would be greatly appreciated!