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


I have a 1 dimension variable array which I am having problems i
accessing each entry

this is the code I have used to populate the array



dim varImpsArray

varImpsarray = wsImps.UsedRange.Value ' used range = a1 to a 62000


Is their a way of accessing each entry in the array *similar* to the
For Each cell In Range("a1:a3") that applies to spreadsheets


dim ?????? as ????
for each ?????????


I am using Excel 9

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Variable Array Problem

Mud,

Try a slight variation:

Dim varImpsArray()
varImpsArray = wsImps.UsedRange (I don't think you need ".Value" here)

Your array is a 2 dimension array (that's the way this array read method
works), so:

imax= Ubound(varImpArray,1)
For i =1 to imax
test=varImpArray(i,1)
next i

If you check the locals window in VBE with a break inserted in the program
execution, you will see the structure of varImpsArray.

Hope this helps,
Alex J

"mudraker" wrote in message
...

I have a 1 dimension variable array which I am having problems in
accessing each entry

this is the code I have used to populate the array



dim varImpsArray

varImpsarray = wsImps.UsedRange.Value ' used range = a1 to a 62000


Is their a way of accessing each entry in the array *similar* to the
For Each cell In Range("a1:a3") that applies to spreadsheets


dim ?????? as ????
for each ?????????


I am using Excel 97


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Variable Array Problem


Alex

Thanks for your reply

I just worked it out


dim varImpsArray as Variant
dim varEntry as Variant

varImpsarray = wsImps.UsedRange.Value
For Each varEntry In varImpsarray
do something
next varEntry


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Variable Array Problem

dim varImpsArray as Variant
dim i as long

varImpsarray = wsImps.UsedRange.Value
For i = lbound(varImpsarray,1) to ubound(varImpsarray,1)
debug.print varImpsArray(i,1)
Next i

--
Regards,
Tom Ogilvy



mudraker wrote in message
...

Alex

Thanks for your reply

I just worked it out


dim varImpsArray as Variant
dim varEntry as Variant

varImpsarray = wsImps.UsedRange.Value
For Each varEntry In varImpsarray
do something
next varEntry


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
How do I use a variable as a reference to an array in INDEX Steve Haack Excel Worksheet Functions 6 July 29th 08 06:16 PM
Using COUNTA for a variable array Schannah Excel Worksheet Functions 5 July 22nd 08 05:02 PM
use a variable array in a formula JPderose Excel Discussion (Misc queries) 1 October 20th 05 06:24 AM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM
Copying an array variable to a sheet M Rose Excel Programming 0 July 14th 03 12:04 AM


All times are GMT +1. The time now is 08:47 AM.

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"