Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running A Macro On A List Of Worksheets 2

Status
Not open for further replies.

ADE6

Programmer
Apr 4, 2004
93
GB
Hi,

I have a workbook that contains a worksheet called CALC , in column A of this worksheet I have a list of other worksheets that I would like to run a macro on.

Would it be possible to set up some code that would select the worksheet at the top of the list, perform a macro then select the next worksheet in the list and carry out the macro on that sheet until all worksheets that appear in the list have been updated.

Thanks for the ideas.

Ade
 




Hi,

Please post code questions in VBA Visual Basic for Applications (Microsoft) Forum707.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
This may get you started but if you need any further help You should post in the vba forum.

Record yourself opening the sheets and observe the code.
Rework it using a for Next loop as below

Code:
Dim c as range
For each c in Range("Mylist")
open c.value
do some stuff
next c

you might need to add the path within your code if not in your workbook.

Mypath = "C:\my documents\"
MyFile mypath & c.value
Open MyFile
regards,


Gavin
 



"...I have a list of other worksheets that I would like to run a macro on."

A WORKSHEET is an object within a WORKBOOK.

Are we talkin' 'bout a list of Worksheets or Workbooks?

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
You're right, Skip, I should have read the post properly!


Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top