Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Array Problem 1

Status
Not open for further replies.

sahmiele

Technical User
Sep 9, 2003
67
US
I am having a nightmare of a time with this one. I am trying to load an array based on a variable number of ranges with variable sizes. For some reason, I am only getting values in the array for the last time through the loop. Any help would be greatly appreciated. Thanks in advance!!!

Here is a sample of the code:

dim ArraySkus
'brandcounter is a variable number
c3=0
do
copyrange = "a:" & firstrow & "a:" & lastrow
skucount = lastrow-firstrow+1
redim ArraySkus(skucount)
for each c2 in copyrange
ArraySkus(c3) = c2.value
c3=c3+1
next c2
c1=c1+1
loop until c1 = brand counter
 

Without studying your code completely, it looks like you need to add the preserve keyword to your redim statement.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top