Global Arrays
-
I am writing a VBA macro in Excel, and have declared 2 global string arrays. I am manipulating these arrays in a couple of function without passing them as params -since they are global- however when I return from the first function my array is losing its elements. Is this code error, or am I missing something with arrays.
-
I am writing a VBA macro in Excel, and have declared 2 global string arrays. I am manipulating these arrays in a couple of function without passing them as params -since they are global- however when I return from the first function my array is losing its elements. Is this code error, or am I missing something with arrays.
Ok the problem is because when I was debugging I added a watch for the array variables via the array var in the procedure, which would give it a out of context value when out of the proc. So lesson is when using globals to add watches on the global declaration not the var within a proc to ensure you have the value of the global representation.