tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,926
- Office Version
- 365
- 2019
- Platform
- Windows
Is it possible to refer to a worksheet's codename if it's in another workbook?
If the workbook I am trying to open contains a worksheet called "Data" and its codename is "wksData" then this works:
but this fails:
How can I refer to the "other" workbook's worksheet using its codename?
Thanks
[/FONT]<strike>
</strike>[/FONT]
If the workbook I am trying to open contains a worksheet called "Data" and its codename is "wksData" then this works:
Rich (BB code):
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Workbooks.Open C:\MyLocation\MyFile.xlsm[/FONT]
Dim wb As Workbook
Set wb = Activeworkbook
Dim i As String
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]i = wb.Worksheets("Data").Range("A1").Value
but this fails:
Rich (BB code):
Rich (BB code):
Rich (BB code):
Rich (BB code):
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Workbooks.Open C:\MyLocation\MyFile.xlsm[/FONT]
Dim wb As Workbook
Set wb = Activeworkbook
Dim i As String
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]i = wb.wksData.Range("A1").Value
How can I refer to the "other" workbook's worksheet using its codename?
Thanks
</strike>[/FONT]