passing sheet address to subroutine

Danny54

Board Regular
Joined
Jul 3, 2019
Messages
125
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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
12,882
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,102,291
Messages
5,485,973
Members
407,523
Latest member
Talicius

This Week's Hot Topics

Top