Disclaimer: "unknown" in Thread title means that I don't know the name of the concept I am about to describe. (Have not done a VBA course yet so please forgive what is probably a newbie question).
Please see pseudo code below
Sub Test1()
dim a as string
dim b as long
a = "xyz"
b = 1.45
(some code here)
End Sub
Sub Test2()
(some code here)
dim a as string
a = "xyz"
(some code that uses a)
dim b as long
b = 1.45
(some code that uses b)
End Sub
Assume that the above two sketches are the same macro except that in the first I am declaring my Dims etc as soon as the macro starts and in the second I am declaring 'just in time' (so they are declared just before the code lines that require them).
- What is the name of the concept I have described above?
- What is the pros & cons of each method?
- Would the second method be faster as the memory doesn't have to hold the data when it doesn't need to?
Appreciate any answers to the above!
Bookmarks