passing sheet address to subroutine

Danny54

Board Regular
Joined
Jul 3, 2019
Messages
113
what is a correct way to access a open workbook.sheet that is currently open when linking to a subroutine or a function?


ie..
i open two workbooks in the main routine and the based on a condition in the main routine i link to a subroutine. I can't figure out how to read a value on the open sheets from within the subroutine.

Thanks
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
12,726
Office Version
365, 2010
Platform
Windows, Mobile
I don't really understand what you are asking, to access a cell in another open workbook you just reference the workbook...

Code:
Workbooks("TheOpenWorkbookName").Sheets("TheNameOfTheSheet").Cells(1, 1)
 

Watch MrExcel Video

Forum statistics

Threads
1,100,187
Messages
5,473,023
Members
406,843
Latest member
David_Welland

This Week's Hot Topics

Top