Avatar of Jagwarman
Jagwarman
 asked on

find Sheet but sheet name not known

sounds crazy but.

Can an expert help me out with vba code that will look into the sheets in my workbook and find GLOBAL RATES in cell A1

when it finds that I need to copy the sheet and copy it to a new sheet in a different workbook.

I am using the below code to do copy sheets to different workbooks

Sheets("Sheet Name").Copy After:=Workbooks("Weekly Metrics Template.xlsx").Sheets("Sheet Name")

many thanks
Visual Basic ClassicMicrosoft ExcelMicrosoft OfficeVBA

Avatar of undefined
Last Comment
Jagwarman

8/22/2022 - Mon
[ fanpages ]

Will there be more than one worksheet with "GLOBAL RATES" in cell [A1]?

If so, do you want every matching worksheet to be copied or, perhaps, just the first located & then the searching stops?

Will "Weekly Metrics Template.xlsx" be open concurrently with the workbook that is executing the code required to search/copy the worksheet?
Jagwarman

ASKER
hi Fan pages,

Will there be more than one worksheet with "GLOBAL RATES" in cell [A1]?

No there will only be one

Will "Weekly Metrics Template.xlsx" be open concurrently with the workbook that is executing the code required to search/copy the worksheet?

Yes it will
ASKER CERTIFIED SOLUTION
Ryan Chong

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
[ fanpages ]

Thanks Jagwarman.

Ryan has already progressed making those assumptions, so I do not think I need to provide a suggestion.

PS. Just an afterthought; will any worksheets be Hidden (/VeryHidden)?  If so, should they be ignored?
Your help has saved me hundreds of hours of internet surfing.
fblack61
Jagwarman

ASKER
That's perfect Thank you both