Hi,
I have data in column 'H' where I want to add string "No cases" after number (whereever there, no need to touch that row). Condition is that after record number 6, I want to delete the cell (not complete row )where equal to zero (i.e.mark=0) is present.
Problem is that, when I run the macro, data from column A-F are also affected. How to restrict it in column H only and delete cells with equal to (=0) from 7th records onwards
Data are like this----->
Boys mark Physics=50
Boys mark non-Physics=1
Boys games in Physics=11
Boys games in non-Physics=No Cases
Girls mark Physics=2
Girls mark non-Physics=27
Girls/non-games/Physics/Boys/in=1088
mark=0
ames in non-Physics=0
Sub PROB()
LR = Range("H" & Rows.Count).End(xlUp).Row
Set Rng = Range(Cells(1, 1), Cells(LR, 1))
For i = Rng.Count To 1 Step -1
Pos = InStrRev(Cells(i, 1), "=")
If IsNumeric(Right(Cells(i, 1), Len(Cells(i, 1)) - Pos)) And Right(Cells(i, 1), Len(Cells(i, 1)) - Pos) <> 0 Then
If Right(Cells(i, 1), Len(Cells(i, 1)) - Pos) > 1 Then
Cells(i, 1).Value = Cells(i, 1).Value & " Cases"
ElseIf Right(Cells(i, 1), Len(Cells(i, 1)) - Pos) = 1 Then
Cells(i, 1).Value = Cells(i, 1).Value & " Case"
End If
Else
Cells(i, 1).EntireRow.Delete
End If
Next i
End Sub
Bookmarks