Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
error in macro (next related i think)
Hi, i use the following macro to delete rows from a worksheet
Sheets("MOBILE TOTAL").Select lr = Cells(Rows.Count, "e").End(xlUp).Row For i = lr To 2 Step -1 If Cells(i, "e") < "overhead" And _ Cells(i, "e") < "OPERATIONS" Then Rows(i).Delete Next i eveerything works fine, now i want to use it to delete rows 4 differest worksheets in the same workbook so i figure i make it like this: Sub MOBILEKAPNISIS() Sheets("MOBILE TOTAL").Select lr = Cells(Rows.Count, "e").End(xlUp).Row For i = lr To 2 Step -1 If Cells(i, "e") < "overhead" And _ Cells(i, "e") < "OPERATIONS" Then Rows(i).Delete Next i Sheets("VOICE TOTAL").Select lr = Cells(Rows.Count, "e").End(xlUp).Row For i = lr To 2 Step -1 If Cells(i, "e") < "overhead" And _ Cells(i, "e") < "OPERATIONS" Then Rows(i).Delete Next i Sheets("BLACKBERRY TOTAL").Select lr = Cells(Rows.Count, "g").End(xlUp).Row For i = lr To 2 Step -1 If Cells(i, "g") < "overhead" And _ Cells(i, "g") < "OPERATIONS" Then Rows(i).Delete Next i Sheets("DATA TOTAL").Select lr = Cells(Rows.Count, "g").End(xlUp).Row For i = lr To 2 Step -1 If Cells(i, "g") < "overhead" And _ Cells(i, "g") < "OPERATIONS" Then Rows(i).Delete Next i End Sub but nope it dosent work, anyone can help me out? thanks in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run time error related to add-ins | Excel Discussion (Misc queries) | |||
related to error function | Excel Discussion (Misc queries) | |||
Error trapping is not working for errors related to files | Excel Programming | |||
Syntax error - FSO related? | Excel Programming | |||
macro related | Excel Discussion (Misc queries) |