Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete the non blank rows depending on Column
Hello
I need some help with this please. I would like to create a Marco that will help me delete the non blank rows depending on Column C. For example, a Marco will delete everything except Row 2 Column C and Row 4 Column C. Since Column C for those 2 rows is blank it will not delete. A B C 1 meeting Yes 20 2 meeting Yes 3 meeting Yes 10 4 meeting Yes 5 meeting Yes 100 So after the Macro, it should look something like this A B C 1 meeting Yes 2 meeting Yes Thank you very much Harn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete the non blank rows depending on Column
Hi,
Right click your sheet tab, view code and paste this in and run it. Sub stance() Dim MyRange As Range Dim DelRange As Range Lastrow = Cells(Cells.Rows.Count, "C").End(xlUp).Row Set MyRange = Range("C1:C" & Lastrow) For Each C In MyRange If Not IsEmpty(C) Then If DelRange Is Nothing Then Set DelRange = C.EntireRow Else Set DelRange = Union(DelRange, C.EntireRow) End If End If Next DelRange.delete End Sub Mike "Harn88" wrote: Hello I need some help with this please. I would like to create a Marco that will help me delete the non blank rows depending on Column C. For example, a Marco will delete everything except Row 2 Column C and Row 4 Column C. Since Column C for those 2 rows is blank it will not delete. A B C 1 meeting Yes 20 2 meeting Yes 3 meeting Yes 10 4 meeting Yes 5 meeting Yes 100 So after the Macro, it should look something like this A B C 1 meeting Yes 2 meeting Yes Thank you very much Harn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro to delete rows if cell blank in column | Excel Discussion (Misc queries) | |||
Delete Blank Rows - specify column via dialog | Excel Programming | |||
Delete Rows if any cell in Column H is blank but do not Delete Fir | Excel Programming | |||
Delete entire rows where there is a blank in column A | Excel Programming | |||
To Delete the specific rows when blank is found on column A | Excel Programming |