Cantonalives
Member
Hi all,
I am trying to decrease the height of the blank rows between items on a Pivot Table. The attached works but when fields are expanded, some items that are not blank, are formatted as if they were. My assumption is because the rows were blank and the expansion of the field is not recognising that fact.
Is there a VBA function that would rerun the code whenever a field is expanded? At present code runs on a PVT refresh only.
Any help, much appreciated.
Thanks,
-CL
I am trying to decrease the height of the blank rows between items on a Pivot Table. The attached works but when fields are expanded, some items that are not blank, are formatted as if they were. My assumption is because the rows were blank and the expansion of the field is not recognising that fact.
Is there a VBA function that would rerun the code whenever a field is expanded? At present code runs on a PVT refresh only.
Code:
Sub rowheight()
Application.ScreenUpdating = False
Dim hgt As Variant
Dim WorkRng As Range
xTxt = ActiveWindow.RangeSelection.Address
Set WorkRng = Range("$b$16:$b$500")
For Each H In WorkRng
If H.Value = "" Then
hgt = H.Value
H.EntireRow.Select
Selection.rowheight = 2
End If
Next H
End Sub
Any help, much appreciated.
Thanks,
-CL