ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Using Wildcards in Sheet selection (https://www.excelbanter.com/excel-worksheet-functions/18269-using-wildcards-sheet-selection.html)

Jamie

Using Wildcards in Sheet selection
 
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

Jason Morin

Something like:

Dim ws as Worksheet

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

HTH
Jason
Atlanta, GA

-----Original Message-----
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
.



All times are GMT +1. The time now is 05:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com