excel - Typecasting Variant Array into String or Boolean Array -
i have several named ranges inside excel sheet store data vba macros between sessions. when loading need data multiple arrays (string
, booleans
).
dim arr() variant dim rg range set rg = sheets("calc").range("myrange") arr = rg.value2
how can typecast arr()
string
or boolean
array use in macro?
if try , use variant
arrays instead byref argument mismatch errors
on function calls.
or there maybe way contents of ranges array of other type variant
?
searching did not yield result on latter question.
easiest way declare array array of strings or booleans, :
dim arr() string dim arr() boolean
it works functions btw.
and if can't load whole range because of type mismatch, load in temporary variant array , redim string or boolean array match , loop on , use conversion functions : cbool
, cstr
, cint
, cdbl
, ...
Comments
Post a Comment