PDA

View Full Version : Solved: Delete entire row if cell contains string data on Cloumn A



parscon
03-24-2013, 12:50 PM
I need a VBA code that can delete the row , if their column A start with string

For example

A1 : Boy
A2 : 1234 BOY
A3 : 1234

When run the VBA delete the row of A1 ,

Note : I do not want delete only Boy word , delete any word (start by string)

Thank you.

sassora
03-24-2013, 03:24 PM
Is where a word doesn't start with a number ok?


Sub DeleteRowifnotnumeric()
'Deletes a row if it doesn't 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)) = False Then cell.Rows.Delete Shift:=xlUp
Next cell

End Sub

parscon
03-24-2013, 03:45 PM
Thank you very much .
It is Done