Non number cells

G

Guest

Hello,

I'm currently using the following Macro:

===============================================

Dim rng As Range
Dim lastrow As Long
Dim row_index As Long

lastrow = ActiveSheet.Cells(Rows.Count, 1).End(x1Up).Row
For row_index = lastrow - 1 Step -1
If Not IsNumeric(Cells(row_index, 1).Value) Then
Rows (row_index).delete
End IF
Next

===============================================

This will remove any row when a Cell in column "A" is
anyhting else than a number.

What do I need to add if, after doing this first Macro, I
would like to do the same thing but the Cells in
column "C"???

Thanks!!!
 
J

jeff

Hi,

This will look in col C and delete the row

change IsNumeric(Cells(row_index, 1).Value)
to IsNumeric(Cells(row_index, 3).Value)

jeff
 
G

Guest

Hi,

Thanks for the answer!!!

Will this also delete rows in which the cell in
column "C" is empty???

Thanks!!!
 
D

Dave Peterson

Save your workbook and then try it!

If Not application.isnumber(Cells(row_index, 3).Value) Then

is more stringent.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top