parscon
10-29-2013, 03:30 AM
I have a VBA code that will Deletes a row if it does start with a number but it will only delete 2 row like
A1: Apple
A2: 1 Apple
A3: 2 Apple
A4: 3 Apple
A5: 4 Apple
And result will be
A1: Apple
A2: 2 Apple
A3: 4 Apple
I need delete all of row that start with a number.
Thank you.
Sub DeleteRowifnumeric()
'Deletes a row if it does start with a number
Dim rng As Range
Dim cell As Range
Set rng = ActiveSheet.Range("A1").Resize(ActiveSheet.UsedRange.Count, 1)
For Each cell In rng
If IsNumeric(Left(cell.Value, 1)) = True Then cell.Rows.Delete Shift:=xlUp
Next cell
End Sub
A1: Apple
A2: 1 Apple
A3: 2 Apple
A4: 3 Apple
A5: 4 Apple
And result will be
A1: Apple
A2: 2 Apple
A3: 4 Apple
I need delete all of row that start with a number.
Thank you.
Sub DeleteRowifnumeric()
'Deletes a row if it does start with a number
Dim rng As Range
Dim cell As Range
Set rng = ActiveSheet.Range("A1").Resize(ActiveSheet.UsedRange.Count, 1)
For Each cell In rng
If IsNumeric(Left(cell.Value, 1)) = True Then cell.Rows.Delete Shift:=xlUp
Next cell
End Sub