Akiko has attended:
Excel VBA Intro Intermediate course
Recording Macro
I am not sure exactly when I should use
Variable Scope Dim vs Public
Hi Akiko
If you declare a variable as Dim it sets it up to be seen only by the procedure or module that contains it. For example:
Sub Test()
Dim MyName as String
MyName = "Carlos"
End Sub
If I wanted to access the value of MyName from another procedure it wouldn't find it.
So if the variable you are declaring needs to be accessible by all procedures and modules in a project then it needs to be declared as Public. For example:
Public MyName as String
Hope this helps
Carlos