I'm trying to set a global constant as a worksheet object.
I'm not a fan of globals usually, but it seems dumb (and its a pain in debugging) for me to keep passing pointers to the same sheet over and over.
I cant figure out how to set the constant as a worksheet.
If you type the below code into VBA, you'll find that the stuff I colored red in red is red in VBA, meaning its not the proper syntax. The bottom one is acceptable to VBA, but I get a compile error at run time that says "constant expression required".
Can anyone point me in the right direction?
I'm not a fan of globals usually, but it seems dumb (and its a pain in debugging) for me to keep passing pointers to the same sheet over and over.
I cant figure out how to set the constant as a worksheet.
If you type the below code into VBA, you'll find that the stuff I colored red in red is red in VBA, meaning its not the proper syntax. The bottom one is acceptable to VBA, but I get a compile error at run time that says "constant expression required".
Can anyone point me in the right direction?
Code:
[COLOR=red]Public Const G_wsCert as Worksheet Sheets("CERTIFICATION (2)")[/COLOR]
[COLOR=red]Public Const G_wsCert as Worksheet = Sheets("CERTIFICATION (2)")[/COLOR]
[COLOR=red]Public Const G_wsCert as Worksheet set = Sheets("CERTIFICATION (2)")[/COLOR]
[COLOR=red]Public Const G_wsCert as Worksheet set G_wsCert = Sheets("CERTIFICATION (2)")[/COLOR]
[COLOR=red]Public Const G_wsCert as Sheets("CERTIFICATION (2)")[/COLOR]
Public Const G_wsCert = Sheets("CERTIFICATION (2)")