(Solved) – How do i activate a worksheet from a workbook that i have already opened previously based on cell text from my current workbook in VBA?

(solved)-–-how-do-i-activate-a-worksheet-from-a-workbook-that-i-have-already-opened-previously-based-on-cell-text-from-my-current-workbook-in-vba?

How do i activate the worksheet of the workbook that i have already opened previously based on cell text from my current workbook? For instance, I tried to use the code below to activate the worksheet deviceB in “Book1” where i have already opened from the current workbook that i am using called “anotherworkbook” but it says subscript out of range when clearly the worksheet device B exists in “Book1”.

ThisWorkbook.Worksheets(Sheets(1).Range("A2").Text).Activate 

'trying to activate the worksheet device B in "Book1" from another workbook that i am currently using called "anotherworkbook"

Workbook called book1 that i have already opened where i am trying to activate the worksheet lets say device B based on cell text from my current workbook called “anotherworkbook”

enter image description here

Current workbook that i am using called “anotherworkbook”

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *