excel - VBA array: "Testarray(10)" – What are the initial values of this *without* assigning *any* value to *any* cell? -
when programming in vba, want initialise array as
dim testarray(10) string
now: what initial values of array without further ado?
or asked in way: want use testarray
in order find out values. these values changed "missing line"
or whatsoever. that, able check array values later on in order find number of missing values going through respective array via, e.g., for
-loop or that.
(bonus question: right now, learning how write vba code. array have have name beginning capital letter? or allowed begin small letter?)
you use keyword vbnullstring check empty or uninitialized elements of newly created string array.
dim testarray(10) string testarray(5) = "test" = 0 ubound(testarray) if testarray(i) = vbnullstring ' skip else cells(i + 1, 1).value = testarray(i) end if next
will print "test" in row 6 column 1 (a), , skip uninitialized elements. others have mentioned, in vba testing blank string ("") produce same results in code snippet. not translate rest of .net framework however, strings little more complex. use string.isnullorempty function.
Comments
Post a Comment