Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Excel 2007 Need help for test

I hope somebody can please help asap. I have a huge computer
programming exam tomorrow and I do not understand how to use the redim
statement with dynamic arrays or how to call a subroutine. I have to
know how to do both by tomorrow. Could sombody please break it down
to me. I have been reading excel 2007 vba for dummies but it kind of
skips over these two areas.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Excel 2007 Need help for test

Have you looked at http://support.microsoft.com/kb/142134 (which was the
first thing Google found on the subject)?
--
David Biddulph

wrote in message
...
I hope somebody can please help asap. I have a huge computer
programming exam tomorrow and I do not understand how to use the redim
statement with dynamic arrays or how to call a subroutine. I have to
know how to do both by tomorrow. Could sombody please break it down
to me. I have been reading excel 2007 vba for dummies but it kind of
skips over these two areas.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Excel 2007 Need help for test

When you declare a dynamic array, use the following syntax:

Dim myArray() as Integer

At that point, the size is not determined. You use the ReDim
statement as follows:

ReDim myArray(20)

This will create an array of 20 elements. The first element is
referred to as follows:

myArray(lBound(myArray)) = 1

The last element is referred to as follows:

myArray(uBound(myArray)) = 2

If you ReDim the array again, all the data in it will be overwritten.
To leave the data, you use the Preserve keyword:

ReDim Preserve myArray(50)

Doing so will leave intact the first 20 items (if you have populated
them), and create 30 new ones.


Here's a subroutine example. I'll call the subroutine mySub:

Public Sub mySub()
' do stuff here
End Sub

Now, let's say your main routine is called MainRoutine, which calls
mySub:

Public Sub MainRoutine()
Call mySub()
End Sub


On Nov 28, 2:12 pm, wrote:
I hope somebody can please help asap. I have a huge computer
programming exam tomorrow and I do not understand how to use the redim
statement with dynamic arrays or how to call a subroutine. I have to
know how to do both by tomorrow. Could sombody please break it down
to me. I have been reading excel 2007 vba for dummies but it kind of
skips over these two areas.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Excel 2007 Need help for test

Unless you do something special:
ReDim myArray(20)
will result in an array with 21 elements.

It'll be the same as:
ReDim myArray(0 to 20)

I find that always specifying the upper and lower bounds makes the code more
self-documenting.


iliace wrote:

When you declare a dynamic array, use the following syntax:

Dim myArray() as Integer

At that point, the size is not determined. You use the ReDim
statement as follows:

ReDim myArray(20)

This will create an array of 20 elements. The first element is
referred to as follows:

myArray(lBound(myArray)) = 1

The last element is referred to as follows:

myArray(uBound(myArray)) = 2

If you ReDim the array again, all the data in it will be overwritten.
To leave the data, you use the Preserve keyword:

ReDim Preserve myArray(50)

Doing so will leave intact the first 20 items (if you have populated
them), and create 30 new ones.

Here's a subroutine example. I'll call the subroutine mySub:

Public Sub mySub()
' do stuff here
End Sub

Now, let's say your main routine is called MainRoutine, which calls
mySub:

Public Sub MainRoutine()
Call mySub()
End Sub

On Nov 28, 2:12 pm, wrote:
I hope somebody can please help asap. I have a huge computer
programming exam tomorrow and I do not understand how to use the redim
statement with dynamic arrays or how to call a subroutine. I have to
know how to do both by tomorrow. Could sombody please break it down
to me. I have been reading excel 2007 vba for dummies but it kind of
skips over these two areas.


--

Dave Peterson
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
Pasting a chart from Excel 2007 to Word 2007 trouble Vegas Charts and Charting in Excel 5 September 16th 08 07:37 AM
Need to test MS Office 2007 Compatibility Pack Mr. Low Excel Discussion (Misc queries) 1 September 24th 07 02:46 PM
Best VBA test for 2007 in Compatibility Mode? [email protected] Excel Discussion (Misc queries) 2 May 3rd 07 03:19 AM
Calculate mean of test scores from rows of test answers RiotLoadTime Excel Discussion (Misc queries) 1 July 26th 06 05:14 PM
test..where are my messages..test HT New Users to Excel 0 January 23rd 05 06:23 PM


All times are GMT +1. The time now is 02:39 PM.

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

About Us

"It's about Microsoft Excel"