PC Review


Reply
Thread Tools Rate Thread

array inside for statement

 
 
Student
Guest
Posts: n/a
 
      11th Jan 2008
Hello
i have an array inside a for statment and i was to reset the array everytime
the for statment run
how may i rest an array
please advice thank you
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      11th Jan 2008
So you want to resize the array each time you loop? If so then take a look at
ReDim Preserve. Something like this...

Sub Tada()
Dim MyArray() As Long
Dim lng As Long

For lng = 0 To 9
ReDim Preserve MyArray(lng)
MyArray(lng) = lng
Next lng

For lng = LBound(MyArray) To UBound(MyArray)
MsgBox MyArray(lng)
Next lng
End Sub
--
HTH...

Jim Thomlinson


"Student" wrote:

> Hello
> i have an array inside a for statment and i was to reset the array everytime
> the for statment run
> how may i rest an array
> please advice thank you

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement inside a SUMIF statement.... or alternative method Sungibungi Microsoft Excel Worksheet Functions 3 4th Dec 2009 06:22 PM
Autofill inside if/then statement Devon Microsoft Access VBA Modules 2 24th Aug 2009 03:01 PM
vlookup inside an if statement? carlosgdlf Microsoft Excel Misc 3 4th Aug 2005 02:36 AM
OR statement inside a COUNTIF statement Carla Microsoft Excel Worksheet Functions 3 25th Jun 2004 07:38 PM
How to add a TAB inside of an IIF statement? George Soares Microsoft Access Reports 1 11th Dec 2003 10:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:36 PM.