Results 1 to 4 of 4

Thread: Excels and Arrays (Resolved)

  1. #1

    Thread Starter
    Lively Member TheFIDDLER's Avatar
    Join Date
    May 2002
    Location
    here and there and far away
    Posts
    126

    Excels and Arrays (Resolved)

    Here's the setup, I am using arrays to store data to perform calculations in memory and then assigning the array back to the range. It's impressively quick when compared to usual excel calculation speeds.

    So it's something like: (never mind the syntax this is not my main problem, but just to let you know the process)

    Array = Range ("B11", "AC1200")

    So first array dimension has my rows (11 to 1200), and the second array dimension has my collumns (B to AC).

    I want to added a new record, or row to my table (anywhere, beginning or end is fine), but can't redim my array in my first dimension.) It lets me add extra collumns, but not rows.

    I am aware that I can always write the extra row directly to the worksheet but it I still need to do more data manipulation before pasting the data.

    Anyone with a solution that I can try?

    Thanks
    Last edited by TheFIDDLER; Feb 3rd, 2004 at 04:56 PM.
    -----
    #VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP

    I miss my VIC 20.
    Never should have upgraded to my commodore 64. ...

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    I think you can only Redim the last dimension, so you would have to convert your array to change the dimensions.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    Lively Member TheFIDDLER's Avatar
    Join Date
    May 2002
    Location
    here and there and far away
    Posts
    126
    Can I tranpose my array? Such that my first dimension becomes my last dimension. First dimension has 1 to 867 items, Second Dimension has 1 to 27 items.

    I assume this would mean transferring the data to a separate array in order to do the move.

    Any ideas on how to code this?

    Thanks.

    - that's what I get for trying to use an array as a grid control or database....
    -----
    #VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP

    I miss my VIC 20.
    Never should have upgraded to my commodore 64. ...

  4. #4
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Nothing easier than that:

    OriginalArray (1 to A, 1 to B)

    NewArray (1 to B, 1 to A)

    VB Code:
    1. for i=1 to A
    2.     for j=1 to B
    3.         NewArray(j,i)=OriginalArray(i,j)
    4.     next j
    5. next i
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width