I just can't figure out how to use a public variable in Excel that can be shared between procedures throughout the workbook. I'm using Excel 2000 9.0 SR-1 which has VBA 6.0
I've tried declaring a public variable at workbook level:
and then incrementing it in Subs both in sheets and in a module. Neither worked - the variable PubOne within each Sub (undeclared) didn't increment and was local to each Sub.
What *did* work was declaring the variable as public in the declarations part of the worksheet. But that only shared it between procedures in that worksheet.......
What am I doing wrong?
I've tried declaring a public variable at workbook level:
Code:
Public PubOne as Integer
and then incrementing it in Subs both in sheets and in a module. Neither worked - the variable PubOne within each Sub (undeclared) didn't increment and was local to each Sub.
What *did* work was declaring the variable as public in the declarations part of the worksheet. But that only shared it between procedures in that worksheet.......
What am I doing wrong?