Using Wildcards in Sheet selection

J

Jamie

Hi There

I need to run one macro for 5 slightly different named spreadsheets.

At the moment, as I'm copying pivot tables between two spreadsheets I have a
few lines like this:

Windows("Extra Triangles - MOT.xls").Activate

I have 4 other sheets that I want to use the same Macro on called

Extra Triangles - AMO.xls
Extra Triangles - INT.xls
Extra Triangles - CAR.xls
Extra Triangles - ALL.xls

Is there a way I can change this line to just activate any spreadsheet that
begins with - Extra Triangles?

Any help would be greatly appreciated.

Thanks in advance

Jamie
 
J

Jason Morin

Something like:

Dim ws as Worksheet

With ws
If .Name Like "Extra Triangles*" Then ......
End With

HTH
Jason
Atlanta, GA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top