View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
klysell klysell is offline
external usenet poster
 
Posts: 146
Default Moving through worksheets and enacting formatting macro

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.
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557