delete a row if the column contains a non numeric value

pals70423

New Member
Joined
Feb 6, 2011
Messages
25
Hi all,
I am creating a macro to check if a column A has non numeric value and if it they are present then the macro need to remove the non numeric rows.

could any one kindly help on the same.
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Sub test()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
    If Not IsNumeric(Range("A" & i).Value) Then Rows(i).Delete
Next i
End Sub
 

JamesW

Well-known Member
Joined
Oct 30, 2009
Messages
1,197
Hi there,

Try:

Code:
Sub test()
    lRow = Range("A65536").End(xlUp).Row
    For i = lRow To 1 Step -1
        If Not IsNumeric(Cells(i, 1)) Then Cells(i, 1).EntireRow.Delete
    Next
End Sub

Edit: Added Not IsNumeric - Read OP wrong.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,466
Messages
5,528,968
Members
409,848
Latest member
Blomsten
Top