Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 cells 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
|
|||
|
|||
![]()
Sub Remove_Blank_Rows()
'Highlight range of cells on wksheet;this deletes 'all rows with cells exactly matching cases Dim rng As Range Dim Cell, RowArray As Range Set rng = ActiveSheet.Range(Cells(2, "C"), Cells(Rows.Count, "C").End(xlUp)) For Each Cell In rng Select Case Cell Case Is = "" ' If RowArray Is Nothing Then Set RowArray = Cell.EntireRow Else Set RowArray = Union(RowArray, Cell.EntireRow) End If End Select Next Cell On Error Resume Next RowArray.delete Err.Clear End Sub "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 cells 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry change this line Case Is = "" with this Case Is < ""
"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 cells 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 | |
|
|
![]() |
||||
Thread | Forum | |||
Delete Rows if any cell in Column H is blank but do not Delete Fir | Excel Programming | |||
How do I delete blank rows (rows alternate data, blank, data, etc | Excel Discussion (Misc queries) | |||
Delete all blank rows... | Excel Discussion (Misc queries) | |||
delete blank rows | Excel Discussion (Misc queries) | |||
Delete blank row only if 2 consecutive blank rows | Excel Programming |