Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I use a variable as a reference to an array in INDEX | Excel Worksheet Functions | |||
Using COUNTA for a variable array | Excel Worksheet Functions | |||
use a variable array in a formula | Excel Discussion (Misc queries) | |||
Problem trying to us a range variable as an array variable | Excel Programming | |||
Copying an array variable to a sheet | Excel Programming |