ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Collapsing filtered macro (https://www.excelbanter.com/excel-worksheet-functions/193148-collapsing-filtered-macro.html)

DFrank

Collapsing filtered macro
 
i ran a macro, and it deleted a bunch of error cells, but left a bunch of
blank cells such as the following:

a




b




c



how do i get it to collapse to the form:
a
b
c?

Prefereably within the same macro.

Thanks for any help.

Debra Dalgleish

Collapsing filtered macro
 
If you sort the range by that column all the blanks should end up at the
bottom.

DFrank wrote:
i ran a macro, and it deleted a bunch of error cells, but left a bunch of
blank cells such as the following:

a




b




c



how do i get it to collapse to the form:
a
b
c?

Prefereably within the same macro.

Thanks for any help.



--
Debra Dalgleish
Contextures
www.contextures.com/tiptech.html
Blog: http://blog.contextures.com


ryguy7272

Collapsing filtered macro
 
this may work for you (if those really are blanks):
Sub HideBlanks()

Dim rng As Range
On Error Resume Next
Range("A1:A20").EntireRow.Hidden = False '< -- Change this range to suit
your needs
Set rng = Range("A1:A20").SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.Hidden = True
End If

End Sub

This will unhide the blanks:
Sub UnHideBlanks()

Dim rng As Range
On Error Resume Next
Range("A1:A20").EntireRow.Hidden = False
Set rng = Range("A1:A20").SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.Hidden = False
End If

End Sub





Regards,
Ryan---



--
RyGuy


"Debra Dalgleish" wrote:

If you sort the range by that column all the blanks should end up at the
bottom.

DFrank wrote:
i ran a macro, and it deleted a bunch of error cells, but left a bunch of
blank cells such as the following:

a




b




c



how do i get it to collapse to the form:
a
b
c?

Prefereably within the same macro.

Thanks for any help.



--
Debra Dalgleish
Contextures
www.contextures.com/tiptech.html
Blog: http://blog.contextures.com




All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com