Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Declaring arrays

Can somebody remind me the syntax to declare arrays in Excel modules?
  #2   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Declaring arrays

What i need to do:

Declare an array, but size unknown. Thus, programmatically I need to expand
the size.

"DKS" wrote:

Can somebody remind me the syntax to declare arrays in Excel modules?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Declaring arrays

Dim MyIntegerArray() As Integer

Use ReDim to define it at runtime
"DKS" wrote:

What i need to do:

Declare an array, but size unknown. Thus, programmatically I need to expand
the size.

"DKS" wrote:

Can somebody remind me the syntax to declare arrays in Excel modules?

  #4   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Declaring arrays

Thanks Suhas. That is exactly what I was trying to remember.

"Suhas" wrote:

Dim MyIntegerArray() As Integer

Use ReDim to define it at runtime
"DKS" wrote:

What i need to do:

Declare an array, but size unknown. Thus, programmatically I need to expand
the size.

"DKS" wrote:

Can somebody remind me the syntax to declare arrays in Excel modules?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Declaring arrays

You need to use a Dynamic Array; that is, an array whose bounds are not
specified in the Dim statement but rather set at run-time with the Redim
function. For example,

Dim Arr() As String
Dim N As Long

N = SomeValue
Redim Arr(1 to N)

If you use Redim on an existing array, the contents of the array are
destroyed unless you use the Preserve modifer:

Redim Preserve Arr(1 To N)



--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

"DKS" wrote in message
...
What i need to do:

Declare an array, but size unknown. Thus, programmatically I need to
expand
the size.

"DKS" wrote:

Can somebody remind me the syntax to declare arrays in Excel modules?




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
Declaring Multi-Dimensional Arrays Clayman Excel Programming 5 August 10th 09 06:00 PM
Arrays - declaration, adding values to arrays and calculation Maxi[_2_] Excel Programming 1 August 17th 06 04:13 PM
Declaring 2 dimensional arrays Dan[_49_] Excel Programming 4 November 17th 05 08:36 PM
declaring Arrays to use in a Form with few modules coco Excel Programming 3 July 18th 05 02:46 PM
Declaring arrays Alan Beban[_2_] Excel Programming 22 May 12th 04 08:10 AM


All times are GMT +1. The time now is 02:18 AM.

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"