S
Sabosis
Hello-
I have tried multiple examples to get rows deleted where the value in
column B is less than 50. In my code, before the attached code runs, I
have formatted column B as a number, no decimals. Can anyone tell me
why the code is erroring our?
Sub DeleteCallTags()
'will delete rows where column B <50
Dim cell As Range
Dim delRange As Range
For Each cell In Range("B1:B" & Range("B" &
Rows.Count).End(xlUp).Row)
If cell.Value < 50 Then ******This is the line that
gets highlighted when I hit "debug"
If delRange Is Nothing Then
Set delRange = cell
Else
Set delRange = Union(delRange, cell)
End If
End If
Next cell
If Not delRange Is Nothing Then delRange.EntireRow.Delete
End Sub
I have tried multiple examples to get rows deleted where the value in
column B is less than 50. In my code, before the attached code runs, I
have formatted column B as a number, no decimals. Can anyone tell me
why the code is erroring our?
Sub DeleteCallTags()
'will delete rows where column B <50
Dim cell As Range
Dim delRange As Range
For Each cell In Range("B1:B" & Range("B" &
Rows.Count).End(xlUp).Row)
If cell.Value < 50 Then ******This is the line that
gets highlighted when I hit "debug"
If delRange Is Nothing Then
Set delRange = cell
Else
Set delRange = Union(delRange, cell)
End If
End If
Next cell
If Not delRange Is Nothing Then delRange.EntireRow.Delete
End Sub