Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
String Array initialisation
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
String Array initialisation
This will work:
Dim VarNames VarNames = ActiveSheet.Range("K22:K32").Value RBS 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
String Array initialisation
If it is unacceptable for VarNames to be of Variant() type (which is
what the other replies in this thread have provided), then if the functions in the freely downloadable file at http:/home.pacbell.net/beban are available to your workbook Sub test2() Dim VarNames() As String Assign ActiveSheet.Range("K22:K32"), VarNames End Sub Alan Beban wrote: 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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
String array initialisation | Excel Programming | |||
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 |