Setofskills
New Member
- Joined
- Aug 17, 2015
- Messages
- 9
I am trying to remove entire rows that filter on certain criteria. I'm doing it by writing:
Range(Cells(3, 1), Cells(LastRow, LastColumn)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
But I have grouped columns in my data so I get errors. My work around is to write:
My question is:
Thanks in advance.
Range(Cells(3, 1), Cells(LastRow, LastColumn)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
But I have grouped columns in my data so I get errors. My work around is to write:
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=3
Range(Cells(3, 1), Cells(LastRow, LastColumn)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
Range(Cells(3, 1), Cells(LastRow, LastColumn)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
My question is:
- how can I find out how many ColumnLevels I have so that I can replace the 3 in "ColumnLevels:=3" to something like ColumnLevels:=MaxColumnLevels?
- OR how can I delete an entire row when for visible cells that includes collapsed/grouped columns?
Thanks in advance.