sheet selection macro

  • Thread starter Thread starter jdm
  • Start date Start date
J

jdm

I need to create a macro that will "loop" through the
individual sheets in a spreadsheet regardless of the tab
name. I have numerous spreadsheets and the tab for the
sheets are named differently in each spreadsheet so I need
a macro that can be imported into each that will run as I
am using this in conjuction with a find and replace macro.
Thanks,
JDM
 
Do you mean

For Each sh In Activeworkbok.Worksheets
' whatever you want to do
Next sh

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Bob
That is what I need. I am nesting a macro within this and
I need it to loop through each sheet in the workbook. I
pasted the "for each sh" statement in front and the "next
sh" at the end but it did not work.
I am doing a find and replace with mulitple variables.
When I do this manually and select all the sheets and
record the macro it works but when I select all the sheets
and run the macro it does not work.
 
Are you referencing the worksheet through the sh variable? For instance

For Each sh In Activeworkbok.Worksheets
sh.Columns(1).Replace _
What:= etc.
Next sh

If it is not this post the code.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top