G
Guest
Hi,
I have a macro assigned to the CommandButton1 on each worksheet starting on
the sixth worksheet and going until the last tab of my workbook. In each
instance, the macro does the same procedure, but only acting on the worksheet
to which it is attached. How do I move through these worksheets one-at-a-time
and enact the macro button?
The procedure that is assigned to this button is called "formatting" and
deals with formatting my pivot tables. I've tried other more efficient
methods, but they seem to only act on my summary sheet and not move through
my workbook.
Here is the code that I've come up with thus far:
Dim pt As PivotTables
Dim sh As Worksheet
For Each ws In sh.PivotTables
With pt
Call Formatting(pt)
End With
Next ws
What am I doing wrong?
Thanks in advance,
Kent.
I have a macro assigned to the CommandButton1 on each worksheet starting on
the sixth worksheet and going until the last tab of my workbook. In each
instance, the macro does the same procedure, but only acting on the worksheet
to which it is attached. How do I move through these worksheets one-at-a-time
and enact the macro button?
The procedure that is assigned to this button is called "formatting" and
deals with formatting my pivot tables. I've tried other more efficient
methods, but they seem to only act on my summary sheet and not move through
my workbook.
Here is the code that I've come up with thus far:
Dim pt As PivotTables
Dim sh As Worksheet
For Each ws In sh.PivotTables
With pt
Call Formatting(pt)
End With
Next ws
What am I doing wrong?
Thanks in advance,
Kent.