Hi, I have two questions about scope.
1. Can two modules have the same subroutine names other than the first one called from the user form? Ie, I have two user forms with a button on each. I want one button to call the subroutine on one module and the second button to call a subroutine on the second module. The code is very similar for both. Other than those very first subroutines that are called, can the rest of them be named the same on both modules? Once in the module, does it have scope?
Incase I didn't explain it properly:
module1 has:
GetData()
ProcessData()
module2 has:
GetOtherData()
ProcessData()
Will that work or mess everything up?
2. In multiple areas in my code, I have the constant MyWorkbookName. I have to change this multiple places at the beginning of every year. Is there a place where I can put that where all the code will reference it, so I only have to change it in the one place?
1. Can two modules have the same subroutine names other than the first one called from the user form? Ie, I have two user forms with a button on each. I want one button to call the subroutine on one module and the second button to call a subroutine on the second module. The code is very similar for both. Other than those very first subroutines that are called, can the rest of them be named the same on both modules? Once in the module, does it have scope?
Incase I didn't explain it properly:
module1 has:
GetData()
ProcessData()
module2 has:
GetOtherData()
ProcessData()
Will that work or mess everything up?
2. In multiple areas in my code, I have the constant MyWorkbookName. I have to change this multiple places at the beginning of every year. Is there a place where I can put that where all the code will reference it, so I only have to change it in the one place?
Last edited: