Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default How do you dynamically load an array?

Hi all. Over the last month or so, I have familliarized myself (almost
painfully so) with utilizing arrays and loops together in my macros for
efficiency (and sanity).

What I am wondering, is how do you load an array dynamically?

I know well how to declare one such as

V = Array("stuff","morestuff") etc etc
However what if the contents of the array need to change on a weeky basis? I
hate having to go in and reprogram it, and was wondering if there was a way
to load it dynamically?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How do you dynamically load an array?

Maybe soimething like

ReDim Preserve ary(UBound(ary) + 1)
ary(UBound(ary)) = "xyz"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"havocdragon" wrote in message
...
Hi all. Over the last month or so, I have familliarized myself (almost
painfully so) with utilizing arrays and loops together in my macros for
efficiency (and sanity).

What I am wondering, is how do you load an array dynamically?

I know well how to declare one such as

V = Array("stuff","morestuff") etc etc
However what if the contents of the array need to change on a weeky basis?

I
hate having to go in and reprogram it, and was wondering if there was a

way
to load it dynamically?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default How do you dynamically load an array?


havocdragon wrote:
Hi all. Over the last month or so, I have familliarized myself (almost
painfully so) with utilizing arrays and loops together in my macros for
efficiency (and sanity).

What I am wondering, is how do you load an array dynamically?

I know well how to declare one such as

V = Array("stuff","morestuff") etc etc
However what if the contents of the array need to change on a weeky basis? I
hate having to go in and reprogram it, and was wondering if there was a way
to load it dynamically?


You may want to declare the array as opposed to using the array
function. Without clarification it is unclear what you want to do. Here
is a sub that loads an array with the weeks dates starting with today.

Sub ldarray()
Dim myarray(1 To 7) As Variant
Dim c As Variant
Dim i As Integer

c = Now()
For i = 0 To 6
myarray(i + 1) = Format(c + i, "mm/dd/yyyy")
Next


End Sub

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
Dynamically load DataValidation List through Source field? Dave Excel Worksheet Functions 1 February 12th 10 08:35 PM
load addresses of selected cells into array galefly Excel Programming 6 April 30th 06 12:42 AM
Load a static array at procedure level XP Excel Programming 1 March 10th 06 04:27 PM
Load excel range into multi dimensional array Rishi Dhupar Excel Programming 1 January 26th 06 03:50 PM
Load an array with Sheet names S G Booth Excel Programming 6 March 2nd 05 08:48 PM


All times are GMT +1. The time now is 09:44 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"