hellfire45
Active Member
- Joined
- Jun 7, 2014
- Messages
- 464
Hi guys,
So I have some VBA. I am declaring a public variable as integer in module 1 and lets say for example in module 1 it is declared as a value = 19.
Then module 2 starts and I do not re-declare it and I apparently don't need to because VBA Doesn't error and ask me to. So I expect the value will still be 19. However, its not, its equal to zero. Not blank, but zero.
So if I hit a break point in the code and check the value of the variable in each module module 1 will say 19 and module 2 says 0. I need both modules to know that the variable is equal to 19.
Why is this happening? Thanks for the help.
So I have some VBA. I am declaring a public variable as integer in module 1 and lets say for example in module 1 it is declared as a value = 19.
Code:
Public batch_audit_col As Integer
Code:
batch_audit_col = Application.Match("BATCH1", Dash.Rows("1:1"), 0)
Then module 2 starts and I do not re-declare it and I apparently don't need to because VBA Doesn't error and ask me to. So I expect the value will still be 19. However, its not, its equal to zero. Not blank, but zero.
So if I hit a break point in the code and check the value of the variable in each module module 1 will say 19 and module 2 says 0. I need both modules to know that the variable is equal to 19.
Why is this happening? Thanks for the help.