Excel VBA: Option Explicit, module level variable scope?

No replies
User offline. Last seen 3 years 30 weeks ago. Offline
Joined: 10/26/2008
Posts: 11

At the top of the module I have:

Option Explicit
Dim count As Integer
count = 4

Then I have a procedure called "Outline" and another procedure called "findNextChargeNo." Within the "Outline" procedure, I am calling the "findNextChargeNo" procedure. The variable "count" is used inside of "findNextChargeNo." After "findNextChargeNo." is executed inside of "Outline," I reference the "count" variable before the "Outline procedure is completed.

Therefore I need the "count" variable to have a module level scope so that "Outline" and "findNextChargeNo." can access that variable. When I run the program, it doesn't run. I get a yellow cursor highlighting the "4" in count = 4.

Can anybody please offer some insight as to what is wrong?
Colanth. It worked. Thank you very much. This was driving me crazy.
I would rate this as the best answer, but I don't see an option that enables me to do so. Thank you again.