If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Non number cells
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!!! |
#2
|
|||
|
|||
Non number cells
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 -----Original Message----- 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!!! . |
#3
|
|||
|
|||
Non number cells
Hi,
Thanks for the answer!!! Will this also delete rows in which the cell in column "C" is empty??? Thanks!!! -----Original Message----- 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 -----Original Message----- 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!!! . . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
make a function that add number 1 in another number | Manos | Worksheet Functions | 3 | February 3rd, 2004 01:37 PM |
count the number of cells that have a particular fill colour? | Martin Y | Worksheet Functions | 4 | October 27th, 2003 04:45 AM |