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

Can anyone suggest a way to ReDimension the R dimension in
ReDim Preserve a(R,C) ?
--
Thanks for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Preserve keyword

You can't. If C is fixed in size, then just swap the dimensions.

--
Rick (MVP - Excel)


"LesHurley" wrote in message
...
Can anyone suggest a way to ReDimension the R dimension in
ReDim Preserve a(R,C) ?
--
Thanks for your help


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Preserve keyword

Rick; Unfortunately, I can't figure out how to make that work. I want to add
rows to an array with the new rows on the bottom. A worksheet function
Transpose wont because the last column entered woud become the first row.
--
Thanks for your help


"Rick Rothstein" wrote:

You can't. If C is fixed in size, then just swap the dimensions.

--
Rick (MVP - Excel)


"LesHurley" wrote in message
...
Can anyone suggest a way to ReDimension the R dimension in
ReDim Preserve a(R,C) ?
--
Thanks for your help



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Preserve keyword

Perhaps if you give us a little more information about what you have and
what your are trying to do with it, and show us the code you have so far,
maybe someone here can give you some suggestions as to how to proceed. My
answer to your original question still stands... you can only change the
last dimension of an array when using the Preserve keyword... that is a
fixed limitation for dynamic arrays (it has to do with how the array is
stored in memory).

--
Rick (MVP - Excel)


"LesHurley" wrote in message
...
Rick; Unfortunately, I can't figure out how to make that work. I want to
add
rows to an array with the new rows on the bottom. A worksheet function
Transpose wont because the last column entered woud become the first row.
--
Thanks for your help


"Rick Rothstein" wrote:

You can't. If C is fixed in size, then just swap the dimensions.

--
Rick (MVP - Excel)


"LesHurley" wrote in message
...
Can anyone suggest a way to ReDimension the R dimension in
ReDim Preserve a(R,C) ?
--
Thanks for your help




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Preserve keyword

'You can use the worksheet function Transpose() to do it:

'pgc01, http://www.mrexcel.com/forum/showthread.php?p=1790513
Sub TestArray()
Dim v, v1

ReDim v(1 To 3, 1 To 4)

' some code

With Application
v1 = .Transpose(v)
ReDim Preserve v1(1 To 4, 1 To 5)
v = .Transpose(v1)
End With
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Preserve keyword

Thanks everyone. For my present purposes I was able to calculate the
ultimate dimensions of the array before the ReDim and therefor no need for
the Preserve keyword. I'm sending a ParamArray List() to the function and in
this case the size of List() and of each member of it are known when the
function is called. I guess if I ever need more than that I will just write
it in C++.
--
Thanks for your help


"Kenneth Hobson" wrote:

'You can use the worksheet function Transpose() to do it:

'pgc01, http://www.mrexcel.com/forum/showthread.php?p=1790513
Sub TestArray()
Dim v, v1

ReDim v(1 To 3, 1 To 4)

' some code

With Application
v1 = .Transpose(v)
ReDim Preserve v1(1 To 4, 1 To 5)
v = .Transpose(v1)
End With
End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Preserve keyword

You may want to look at the Collection or Dictionary objects.
Depending on what you are doing, they can sometimes simplify complicated
programming.
- - -
Dana DeLouis


LesHurley wrote:
Thanks everyone. For my present purposes I was able to calculate the
ultimate dimensions of the array before the ReDim and therefor no need for
the Preserve keyword. I'm sending a ParamArray List() to the function and in
this case the size of List() and of each member of it are known when the
function is called. I guess if I ever need more than that I will just write
it in C++.

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
most popular keyword Tony_student[_2_] Excel Worksheet Functions 3 June 27th 09 07:19 AM
Keyword Gary''s Student Excel Programming 1 August 5th 06 03:11 PM
Delete row that contains keyword Scott Wagner Excel Programming 2 January 27th 06 10:34 PM
search by keyword SubliminalJones Excel Discussion (Misc queries) 2 December 29th 05 04:29 PM
SQL Keyword S Taylor[_2_] Excel Programming 2 October 6th 04 03:10 PM


All times are GMT +1. The time now is 12:22 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"