Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete certain rows
Hi all,
Im doin a macro, and i need to get code to delete rows in col E tha have have certain data i.e a, c, d, h. But i only want these deleted i the rows in col G are blank. Is the some kind of if statement that ca be used for this? Any help on this would be great. Thanks in advance, Cathal -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete certain rows
Try this for row 1 -100
Sub Example2() Dim Lrow As Long Dim CalcMode As Long Dim StartRow As Long Dim EndRow As Long With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With With ActiveSheet .DisplayPageBreaks = False StartRow = 1 EndRow = 100 For Lrow = EndRow To StartRow Step -1 If .Cells(Lrow, "E").Value = "a" Or _ .Cells(Lrow, "E").Value = "b" Or _ .Cells(Lrow, "E").Value = "c" Then _ If .Cells(Lrow, "G").Value = "" Then .Rows(Lrow).Delete Next End With With Application .ScreenUpdating = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "CPower " wrote in message ... Hi all, Im doin a macro, and i need to get code to delete rows in col E that have have certain data i.e a, c, d, h. But i only want these deleted if the rows in col G are blank. Is the some kind of if statement that can be used for this? Any help on this would be great. Thanks in advance, Cathal. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete certain rows
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete certain rows
You are welcome
-- Regards Ron de Bruin http://www.rondebruin.nl "CPower " wrote in message ... this worked thanks a mill for the help. --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hpw do I delete multiple empty rows found between filled rows? | Excel Worksheet Functions | |||
How to Delete empty rows in excel in b/w rows with values | Excel Worksheet Functions | |||
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows | Excel Worksheet Functions | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions | |||
delete empty rows between rows with text | Excel Discussion (Misc queries) |