I'm using this code to delete rows if column C contains any number on sheet9 only.
But it works fine only when I'm on the same sheet (sheet9).
When I run the code when I'm on another sheet - I get an error: 'Type mismatch' pointing at row: "For I = 1 To UBound(V)"
If someone has a better code option for that, I'll be grateful : )
But it works fine only when I'm on the same sheet (sheet9).
When I run the code when I'm on another sheet - I get an error: 'Type mismatch' pointing at row: "For I = 1 To UBound(V)"
If someone has a better code option for that, I'll be grateful : )
VBA Code:
Option Explicit
Sub delNumRows()
Dim V As Variant
Dim COL As Collection
Dim I As Long
Dim R As Range
V = Range(Cells(1, 3), Cells(Rows.Count, 3).End(xlUp))
Set COL = New Collection
For I = 1 To UBound(V)
If V(I, 1) Like "*[1-9]*" Then COL.Add I
Next I
For Each V In COL
If R Is Nothing Then
Set R = Cells(V, 1).EntireRow
Else
Set R = Union(R, Cells(V, 1).EntireRow)
End If
Next V
R.Delete
End Sub