Hello All,
I'm trying to delete all rows in column G that has a value of greater than 135%, or less than 40%
So if G2 has a value of 140%, than that row would be deleted. Or, if G2 had a value of less than 40%, then that row would also be deleted, and so on to the bottom of the data set.
The code I'm trying to use is:
Also, I'm using r as Dim r as Range.
Thank you for your help
EDIT:
instead of a percent, it may be easer to find a value greater than .135 instead of 135% or a value less than .40 instead of 40%.
Also, I noticed that I originally said 140%, but that is wrong and should be 135%.
Thanks for the help
I'm trying to delete all rows in column G that has a value of greater than 135%, or less than 40%
So if G2 has a value of 140%, than that row would be deleted. Or, if G2 had a value of less than 40%, then that row would also be deleted, and so on to the bottom of the data set.
The code I'm trying to use is:
VBA Code:
For Each sht In ActiveWorkbook.Worksheets
If sht.Visible And (sht.Name) = "Template" Then
For r = sht.Cells(sht.Rows.Count, "G").End(xlUp).Row To 4 Step -1
If (sht.Cells(r, "G").Value) > "135%" or (sht.cells(r,"G:).value < "40%" Then sht.Rows(r).Delete
Next r
End If
Next sht
Also, I'm using r as Dim r as Range.
Thank you for your help
EDIT:
instead of a percent, it may be easer to find a value greater than .135 instead of 135% or a value less than .40 instead of 40%.
Also, I noticed that I originally said 140%, but that is wrong and should be 135%.
Thanks for the help
Last edited by a moderator: