MightyHammer
New Member
- Joined
- Jul 4, 2007
- Messages
- 3
Hi,
I'm trying to write a macro that will delete all rows where the value in Column in C is the same as the one above it BUT not if the value is a blank row. Here's what I have but it keeps erroring on me....can anyone tell me what I'm doing wrong. Thanks!
Do Until lastrow = 1
If Cells(lastrow, 3).Value <> "" Then
If Cells(lastrow, 3).Value = Cells(lastrow - 1, 3).Value Then
Rows(lastrow).Delete
End If
End If
lastrow = lastrow - 1
I'm trying to write a macro that will delete all rows where the value in Column in C is the same as the one above it BUT not if the value is a blank row. Here's what I have but it keeps erroring on me....can anyone tell me what I'm doing wrong. Thanks!
Do Until lastrow = 1
If Cells(lastrow, 3).Value <> "" Then
If Cells(lastrow, 3).Value = Cells(lastrow - 1, 3).Value Then
Rows(lastrow).Delete
End If
End If
lastrow = lastrow - 1