Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VBA to delete certain worksheets rows
Hi everyone
I have a large worksheet that contains a large amount of records wit the same values that are not relevant and need deleting. I am using th following code that does not work. Can anyone please help Sub Macro2() If ActiveCell = ("n/a") Then EntireRow.Delete End If ActiveCell.Offset(1, 0).Select End Sub I would also like the macro to stop when it reaches a cell that doe not contain any value THANK YO -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VBA to delete certain worksheets rows
Hi Avilla,
One way: Sub Tester() Dim Lastcell As Range Dim i As Long Application.DisplayAlerts = False Set Lastcell = Cells(Rows.Count, "A") For i = Lastcell.Row To 1 Step -1 If Cells(i, 1).Value = ("n/a") Then Cells(i, 1).EntireRow.Delete End If Next i Application.DisplayAlerts = True End Sub --- Regards, Norman "avilla " wrote in message ... Hi everyone I have a large worksheet that contains a large amount of records with the same values that are not relevant and need deleting. I am using the following code that does not work. Can anyone please help Sub Macro2() If ActiveCell = ("n/a") Then EntireRow.Delete End If ActiveCell.Offset(1, 0).Select End Sub I would also like the macro to stop when it reaches a cell that does not contain any value THANK YOU --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete all rows below certain value on multiple worksheets? | Excel Discussion (Misc queries) | |||
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents | Excel Discussion (Misc queries) | |||
Add or Delete Rows in Protected worksheets | Excel Discussion (Misc queries) | |||
insert or delete rows across multiple worksheets? | Excel Discussion (Misc queries) | |||
delete rows from multiple worksheets | Excel Worksheet Functions |