'Selecting a sheet from another workbook's cell value

I am trying to select a sheet name in workbook1 called exactly as the cell's value ("K2") in Workbook2 and in a sheet called "GEO_MSCI_Indexes".

The idea is to have a dynamic reference to a worksheet in another workbook.

    Sub zzz()

Dim workbook2 As Workbook
Set workbook2 = Workbooks("Fondi non optica.xlsm")

Dim workbook1 As Workbook
Set workbook1 = Workbooks("MSCI Regional and Country Weights by Market Cap updated BD 2.xls")



workbook1.Sheets(Array(workbook2.Sheets("GEO_MSCI_Indexes").Range("K2").Value)).Select

        

End Sub


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source