Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am facing a problem in intialising a string array in VBA. I need to intialise an array of 10 elements from data in a range. This range has text values. I tried to use following. Code:
Dim VarNames() As String ..... VarNames = ActiveSheet.Range("K22:K32").Value ..... populate the array. Filling each value is cumbersome. Can anybody please suggest some way around. Thanks, Mhr |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dnia 29 Jun 2006 12:21:48 -0700, napisał(a):
Dim VarNames dim r as excel.range, strtmp as string for each r in range("k22:k32").cells 'btw, that's 11 cells, not 10 strtmp = strtmp & switch(strtmp="", "", true, ";") next r VarNames = split(strtmp, ";") There is probably someting better, but I always use this. -- PL |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
declare your VarNames as a variant and drop the ()
-- Tim Williams Palo Alto, CA wrote in message oups.com... Hi, I am facing a problem in intialising a string array in VBA. I need to intialise an array of 10 elements from data in a range. This range has text values. I tried to use following. Code:
Dim VarNames() As String .... VarNames = ActiveSheet.Range("K22:K32").Value .... But I am getting Type Mismatch error. I don't want to use any loop to populate the array. Filling each value is cumbersome. Can anybody please suggest some way around. Thanks, Mhr |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
DTPicker to be dropped down on initialisation | Excel Programming | |||
String array issues. Need help... | Excel Programming | |||
How to avoid re-initialisation when Unloading form | Excel Programming | |||
Passing a String in Array to Range as String | Excel Programming | |||
Convert a string to an array | Excel Programming |