Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to identify the expression column number of pivot chart

Hi Friends

I am trying to hide first expression column in my pivot chart using the following macro  code. But how to call this macro to hide the first expression column in pivot char. Is it N or N-1 or something else.

Public Sub hide

Call HideColumn("CH67",2)

Call HideColumn("CH69",2)

End Sub

Private Sub HideColumn(ch,n)

   Set ch = activeDocument.getsheetobject(ch)

         ch.setpixwidth(n),0

   End Sub

Thanks

3 Replies
Gysbert_Wassenaar

The first column has index number 0, the second 1 etc.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

So the index 0 points first dimension. My requirement is to always hide the first expression. For this I am trying to write a macro like this. But When the user changes the number selections in Pivot table the width is interchanging to other columns. Please tell me how to tweak this macro so that it always identifies the first expression.

Public Sub hide

Call HideColumn("CH67",2)

Call HideColumn("CH69",2)

End Sub

Private Sub HideColumn(ch,n)

   Set ch = activeDocument.getsheetobject(ch)

         ch.setpixwidth(n),0

   End Sub

Thanks

Not applicable
Author

How do you undo this macro? How do you unhide the column you just hid? What would be the macro to "undo" it? I'd like to toggle back and forth.