DougRobertson
Active Member
- Joined
- Sep 22, 2009
- Messages
- 334
- Office Version
- 365
- Platform
- Windows
Hello,
I have created a Timesheet Workbook in Excel 2019, that starts or stops the clock by firing a macro when a specific cell is clicked. That macro lives in the Sheet1 module, and the Sub is named:
Immediately upon the macro firing and at the top of the procedure, I use the following code to ascertain the name of the Timesheet workbook:
I then Call a procedure in a regular module to continue the process of starting or stopping the clock. Is there a way to have the contents of the variable "iActiveTimesheet" available when the macro enters the other regular modules?
A simplified version of the code is as follows:
Sheet1 module:
Module1 (in Modules folder - same workbook):
Thanks in advance for any insight!
~ DWR
I have created a Timesheet Workbook in Excel 2019, that starts or stops the clock by firing a macro when a specific cell is clicked. That macro lives in the Sheet1 module, and the Sub is named:
VBA Code:
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Immediately upon the macro firing and at the top of the procedure, I use the following code to ascertain the name of the Timesheet workbook:
VBA Code:
iActiveTimesheet = ActiveWorkbook.Name
I then Call a procedure in a regular module to continue the process of starting or stopping the clock. Is there a way to have the contents of the variable "iActiveTimesheet" available when the macro enters the other regular modules?
A simplified version of the code is as follows:
Sheet1 module:
VBA Code:
Public iActiveTimesheet As String
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
iActiveTimesheet = ActiveWorkbook.Name
Call a____SATURDAY__Start
End Sub
Module1 (in Modules folder - same workbook):
VBA Code:
Sub a____SATURDAY__Start
Workbooks(iActiveTimesheet).Sheets(1).Range("C7") = "Start the Clock"
End Sub
Thanks in advance for any insight!
~ DWR