tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,834
- Office Version
- 365
- 2019
- Platform
- Windows
I have a master workbook which opens data workbooks.
Each data workbook only contains two worksheets.
The names of the worksheets in each data workbook are different but their codenames are static, say wksyear1 and wksyear2.
How can I refer to the data workbooks' worksheets by its codename?
This code doesn't work because it doesn't know what wksyear1 is.
Thanks
Each data workbook only contains two worksheets.
The names of the worksheets in each data workbook are different but their codenames are static, say wksyear1 and wksyear2.
How can I refer to the data workbooks' worksheets by its codename?
This code doesn't work because it doesn't know what wksyear1 is.
Code:
Dim ws As Worksheet
Set ws = Workbooks(FileName.Name).Worksheets(wksyear1))
Thanks