Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Loading an Array

Hi All,

Everywhere I look, it appears I have to manually load an array ex: a =
array(100, 101, 102 ...)

Is there a way to do it with code? I need 50 items in the array but the
data is always changing.
What I need is:

MyArray(1) = Activecell.offset(1,0)
MyArray(2) = Activecell.offset(2,0)

etc.

When I try, I get a type mismatch error.

Thanks
Chad


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Loading an Array

Got it,

I forgot to declare it properly

Dim MyArray(50) as Variant

not

DimArray as Variant


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Loading an Array

Just to mention an alternative...

Sub Demo()
Dim MyArray()
MyArray = ActiveCell.Resize(50, 1)

'And...if you wish:

MyArray = WorksheetFunction.Transpose(MyArray)
End Sub

--
Dana DeLouis


"Chad" wrote in message
...
Got it,

I forgot to declare it properly

Dim MyArray(50) as Variant

not

DimArray as Variant



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Loading an Array



Everywhere I look, it appears I have to manually load an array ex: a =
array(100, 101, 102 ...)

Is there a way to do it with code? I need 50 items in the array but the
data is always changing.
What I need is:

MyArray(1) = Activecell.offset(1,0)
MyArray(2) = Activecell.offset(2,0)

etc.

When I try, I get a type mismatch error.

Thanks
Chad


Hi Chad
MyArray(1)=activecell.offset(1,0).value

or

for c = 1 to 10
MyArray(c)=activecell.offset(c,0).value
next

Regards

Per


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading data into an array QuietMan Excel Programming 1 April 26th 07 07:48 AM
Loading array into list box r wilcox Excel Programming 5 June 20th 05 11:14 PM
Loading Excel Array from VB Array Faster ExcelMonkey[_3_] Excel Programming 3 January 22nd 04 02:49 AM
Loading Excel Arrange into VBA array [email protected] Excel Programming 5 December 9th 03 01:48 AM
Loading 3 Dimensional Array Alan Beban[_3_] Excel Programming 0 August 31st 03 03:00 AM


All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"