Hide empty text cells

All2Cheesy

Board Regular
Joined
Mar 4, 2015
Messages
127
Hi all,

I've got a macro which shows all fields in a pivot table, and then takes the data and places it alphabetically in another sheet via a formula in the cells of the second sheet. What I would like to do is hide the blank cells (empty text " "). or at the very least move them to the bottom of the column

Currently when I try to hide the blank cells, all cells in the range get hidden, unless I run the formula twice in which case it works. Help would be appreciated. :)

Code:
Sub ShowAllPivot()

'Disable additional features
With Application
        .ScreenUpdating = False
        .Calculation = Manual
        .EnableEvents = False
        .DisplayAlerts = False
End With

Dim oneCell As Range

'Show All
ActiveSheet.PivotTables("PivotTable1").PivotFields("Zone to").ShowDetail = True

'Swap sheets
 ThisWorkbook.Sheets("Summary (Bulk)").Activate
 
'Sort data
    Range("B481:B633").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    ActiveWindow.SmallScroll Down:=6
    ActiveWindow.ScrollRow = 1
    Selection.Sort Key1:=Range("B481"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal

 'Hide blanks 
Range("B481:B633").EntireRow.Hidden = False
For Each oneCell In Range("B481:A633").SpecialCells(xlCellTypeFormulas, xlTextValues)
oneCell.EntireRow.Hidden = (oneCell.Value = vbNullString)
Next oneCell

'Enable additional feautres
With Application
        .ScreenUpdating = True
        .Calculation = xlAutomatic
        .EnableEvents = True
        .DisplayAlerts = True
End With

 'Go to lanes
    ActiveWindow.LargeScroll Down:=1
    Range("A1").Select

End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Edit: Found the issue... Kind of an easy one, but it's been a long day.

I needed to leave calculations automatic.
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top