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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -