View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default 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