I have two Excel Workbooks:
Source.xlsx
Tool.xlsm
Source.xlsx
contains a Worksheet with the VBA Object Name shtTests
:
Let's assume that in Tool.xlsm
I have a variable that contains a reference to the Workbook stored in Source.xlsx
:
Dim wkbSource as Workbook
Set wkbSource = GetSourceWorkbook() ' Some function that gives a reference to the workbook
Core Question: How can I reference shtTests
within Tool.xlsm
by using shtTests
' VBA Name?
Or to formulate the question as code... assume you have this code snippet:
Dim wkbSourceShtTests as Worksheet
Set wkbSourceShtTests = GetShtTestsFromWkbSources(wkbSources)
Question: What does GetShtTestsFromWkbSources
have to look like?
Note: I do not want to reference it by its Excel Name like you would do using wkbSources.Worksheets("Test Cloning")
because people might change its Excel Name some day.