Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default New array with old array elements

I am looking to create a new array with elements of a previously
created array. Whe

For Each cell In Ratings
ReDim Preserve Ratings1(6, rw)

Ratings1(0, rw) = Ratings(0, rw)
Ratings1(1, rw) = Ratings(1, rw)
Ratings1(2, rw) = Ratings(2, rw)
Ratings1(3, rw) = Ratings(3, rw)
Ratings1(4, rw) = Ratings(4, rw)
Ratings1(5, rw) = Ratings(5, rw)
rw = rw - 1
Next Cell

"Ratings" is my old array and "Ratings1" is my new array that i am
creating. "Ratings" is in the same sub and will have the same number
of row elements. For some reason this is not working. When im done not
all elements of Ratings1 will be the same as the Ratings, but im just
trying figure this part out. Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default New array with old array elements

What are you trying to do?

You setup a loop to look through each cell in Ratings, then ignore the value
obtained each time. You redim your array each iteration of the loop, thereby
losing data each time. etc.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

wrote in message
oups.com...
I am looking to create a new array with elements of a previously
created array. Whe

For Each cell In Ratings
ReDim Preserve Ratings1(6, rw)

Ratings1(0, rw) = Ratings(0, rw)
Ratings1(1, rw) = Ratings(1, rw)
Ratings1(2, rw) = Ratings(2, rw)
Ratings1(3, rw) = Ratings(3, rw)
Ratings1(4, rw) = Ratings(4, rw)
Ratings1(5, rw) = Ratings(5, rw)
rw = rw - 1
Next Cell

"Ratings" is my old array and "Ratings1" is my new array that i am
creating. "Ratings" is in the same sub and will have the same number
of row elements. For some reason this is not working. When im done not
all elements of Ratings1 will be the same as the Ratings, but im just
trying figure this part out. Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default New array with old array elements

On Aug 22, 8:38 am, "Bob Phillips" wrote:
What are you trying to do?

You setup a loop to look through each cell in Ratings, then ignore the value
obtained each time. You redim your array each iteration of the loop, thereby
losing data each time. etc.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

wrote in message

oups.com...



I am looking to create a new array with elements of a previously
created array. Whe


For Each cell In Ratings
ReDim Preserve Ratings1(6, rw)


Ratings1(0, rw) = Ratings(0, rw)
Ratings1(1, rw) = Ratings(1, rw)
Ratings1(2, rw) = Ratings(2, rw)
Ratings1(3, rw) = Ratings(3, rw)
Ratings1(4, rw) = Ratings(4, rw)
Ratings1(5, rw) = Ratings(5, rw)
rw = rw - 1
Next Cell


"Ratings" is my old array and "Ratings1" is my new array that i am
creating. "Ratings" is in the same sub and will have the same number
of row elements. For some reason this is not working. When im done not
all elements of Ratings1 will be the same as the Ratings, but im just
trying figure this part out. Thanks- Hide quoted text -


- Show quoted text -


I guess i am just trying to create a new array with old array
elements, but i see your point however i am using redim preserve and
not just redim. I want to create array Ratings1 from Ratings.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default New array with old array elements

not just redim. I want to create array Ratings1 from Ratings.

If you mean copy Ratings to Ratings1, simply

Ratings1 = Ratings

Ratings may have been declared as an array but ....

Dim Ratings1 as Variant

Regards,
Peter T


wrote in message
ups.com...
On Aug 22, 8:38 am, "Bob Phillips" wrote:
What are you trying to do?

You setup a loop to look through each cell in Ratings, then ignore the

value
obtained each time. You redim your array each iteration of the loop,

thereby
losing data each time. etc.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my

addy)

wrote in message

oups.com...



I am looking to create a new array with elements of a previously
created array. Whe


For Each cell In Ratings
ReDim Preserve Ratings1(6, rw)


Ratings1(0, rw) = Ratings(0, rw)
Ratings1(1, rw) = Ratings(1, rw)
Ratings1(2, rw) = Ratings(2, rw)
Ratings1(3, rw) = Ratings(3, rw)
Ratings1(4, rw) = Ratings(4, rw)
Ratings1(5, rw) = Ratings(5, rw)
rw = rw - 1
Next Cell


"Ratings" is my old array and "Ratings1" is my new array that i am
creating. "Ratings" is in the same sub and will have the same number
of row elements. For some reason this is not working. When im done not
all elements of Ratings1 will be the same as the Ratings, but im just
trying figure this part out. Thanks- Hide quoted text -


- Show quoted text -


I guess i am just trying to create a new array with old array
elements, but i see your point however i am using redim preserve and
not just redim. I want to create array Ratings1 from Ratings.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default New array with old array elements

On Aug 22, 9:08 am, "Peter T" <peter_t@discussions wrote:
not just redim. I want to create array Ratings1 from Ratings.


If you mean copy Ratings to Ratings1, simply

Ratings1 = Ratings

Ratings may have been declared as an array but ....

Dim Ratings1 as Variant

Regards,
Peter T

wrote in message

ups.com...



On Aug 22, 8:38 am, "Bob Phillips" wrote:
What are you trying to do?


You setup a loop to look through each cell in Ratings, then ignore the

value
obtained each time. You redim your array each iteration of the loop,

thereby
losing data each time. etc.


--
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my

addy)

wrote in message


roups.com...


I am looking to create a new array with elements of a previously
created array. Whe


For Each cell In Ratings
ReDim Preserve Ratings1(6, rw)


Ratings1(0, rw) = Ratings(0, rw)
Ratings1(1, rw) = Ratings(1, rw)
Ratings1(2, rw) = Ratings(2, rw)
Ratings1(3, rw) = Ratings(3, rw)
Ratings1(4, rw) = Ratings(4, rw)
Ratings1(5, rw) = Ratings(5, rw)
rw = rw - 1
Next Cell


"Ratings" is my old array and "Ratings1" is my new array that i am
creating. "Ratings" is in the same sub and will have the same number
of row elements. For some reason this is not working. When im done not
all elements of Ratings1 will be the same as the Ratings, but im just
trying figure this part out. Thanks- Hide quoted text -


- Show quoted text -


I guess i am just trying to create a new array with old array
elements, but i see your point however i am using redim preserve and
not just redim. I want to create array Ratings1 from Ratings.- Hide quoted text -


- Show quoted text -


Thanks, but in reality i want to have some rows of the new array to be
different values, i was more just looking for the reason that i
couldn't just assign elements of the old array to elements of the new
array by saying that for example Ratings1(1, 5) = Ratings(1,5). For
some reason this is not working.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default New array with old array elements

Then maybe either array doesn't have that particular element.

How is Ratings populated, and where does rw get set?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



wrote in message
ps.com...
On Aug 22, 9:08 am, "Peter T" <peter_t@discussions wrote:
not just redim. I want to create array Ratings1 from Ratings.


If you mean copy Ratings to Ratings1, simply

Ratings1 = Ratings

Ratings may have been declared as an array but ....

Dim Ratings1 as Variant

Regards,
Peter T

wrote in message

ups.com...



On Aug 22, 8:38 am, "Bob Phillips" wrote:
What are you trying to do?


You setup a loop to look through each cell in Ratings, then ignore
the

value
obtained each time. You redim your array each iteration of the loop,

thereby
losing data each time. etc.


--
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my

addy)

wrote in message


roups.com...


I am looking to create a new array with elements of a previously
created array. Whe


For Each cell In Ratings
ReDim Preserve Ratings1(6, rw)


Ratings1(0, rw) = Ratings(0, rw)
Ratings1(1, rw) = Ratings(1, rw)
Ratings1(2, rw) = Ratings(2, rw)
Ratings1(3, rw) = Ratings(3, rw)
Ratings1(4, rw) = Ratings(4, rw)
Ratings1(5, rw) = Ratings(5, rw)
rw = rw - 1
Next Cell


"Ratings" is my old array and "Ratings1" is my new array that i am
creating. "Ratings" is in the same sub and will have the same
number
of row elements. For some reason this is not working. When im done
not
all elements of Ratings1 will be the same as the Ratings, but im
just
trying figure this part out. Thanks- Hide quoted text -


- Show quoted text -


I guess i am just trying to create a new array with old array
elements, but i see your point however i am using redim preserve and
not just redim. I want to create array Ratings1 from Ratings.- Hide
quoted text -


- Show quoted text -


Thanks, but in reality i want to have some rows of the new array to be
different values, i was more just looking for the reason that i
couldn't just assign elements of the old array to elements of the new
array by saying that for example Ratings1(1, 5) = Ratings(1,5). For
some reason this is not working.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default New array with old array elements

Sorry I don't follow what you are trying to do

Ratings1(1, 5) = Ratings(1,5).

Providing each array is sized to accommodate (1,5), and Ratings1 can accept
similar data type to that in Ratings(1,5), the above will work

Regards,
Peter T

<snip

I guess i am just trying to create a new array with old array
elements, but i see your point however i am using redim preserve and
not just redim. I want to create array Ratings1 from Ratings.- Hide

quoted text -


Thanks, but in reality i want to have some rows of the new array to be
different values, i was more just looking for the reason that i
couldn't just assign elements of the old array to elements of the new
array by saying that for example Ratings1(1, 5) = Ratings(1,5). For
some reason this is not working.



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
Use formulas for array elements hmm Excel Discussion (Misc queries) 3 December 3rd 07 01:15 PM
array elements count madeleine[_2_] Excel Programming 6 December 8th 06 03:36 AM
Reference Elements w/in an Array M Moore Excel Discussion (Misc queries) 2 October 16th 06 03:33 PM
Non-unique elements in an array Andrew Excel Discussion (Misc queries) 1 August 22nd 05 11:58 AM
Number of elements in an array Neal Zimm Excel Programming 4 August 12th 05 11:30 AM


All times are GMT +1. The time now is 10:24 AM.

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

About Us

"It's about Microsoft Excel"