Nader
03-19-2008, 10:29 AM
I tired this code to delete some groups of items and replace the their below item in their place as you see in the pic.
Dim LastRow As Long, i As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = LastRow To 1 Step -1
If UCase(Range("B" & i).Value) = "C" And Range("A" & i).Value = 33 Then
Range("A" & i).Delete xlShiftUp
Range("B" & i).Resize(, 5).Delete xlShiftUp
End If
Next i
The problem that I faced, the result didn't keep the last arrangement, it's mean it left tow rows not one row as in the first. How to fix this problem. By the way I don't want to delete and replace a row only the items
I hope I'm clear
Dim LastRow As Long, i As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = LastRow To 1 Step -1
If UCase(Range("B" & i).Value) = "C" And Range("A" & i).Value = 33 Then
Range("A" & i).Delete xlShiftUp
Range("B" & i).Resize(, 5).Delete xlShiftUp
End If
Next i
The problem that I faced, the result didn't keep the last arrangement, it's mean it left tow rows not one row as in the first. How to fix this problem. By the way I don't want to delete and replace a row only the items
I hope I'm clear