+ Reply to Thread
Results 1 to 4 of 4

Add to a two dimensional dynamic array based on a condition - redim preserve

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    87

    Add to a two dimensional dynamic array based on a condition - redim preserve

    hi

    i have a column with some cells containing text and others numbers. I would like to go down the sheet
    and when i get to a cell with a number. add it to the array and right next to it, the cell address.

    i don't want to have any empty array elements, so i cant just add the whole column to a variant.
    The array should be 'redim preserved' only when i encounter a cell with a number in it.

    i basically want to end up with an array that when written to a worksheet is a two column range
    with x number of rows.

    how would i go about this please?

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Add to a two dimensional dynamic array based on a condition - redim preserve

    Try this:-
    NB:- Basic Data in column "A", Results vin columns"D/E".
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    04-19-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Add to a two dimensional dynamic array based on a condition - redim preserve

    hi Mick! Thanks very much. this worked and i modified it a little too.
    im relatively new to VBA and cant get my head round arrays, got myself in knots with "Redim preserve" etc

    Appreciate the help mate!

    cheers

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Add to a two dimensional dynamic array based on a condition - redim preserve

    You're welcome

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Redim preserve two dimensional array problem
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2013, 05:29 PM
  2. [SOLVED] Two dimensional array Redim preserve problem
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2013, 04:44 AM
  3. [SOLVED] Dynamic Array Fails to Redim Preserve
    By rodalsa1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2013, 09:52 AM
  4. dynamic array redim preserve: run-time error 9, Subscript out of range.
    By Broesel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2009, 08:39 AM
  5. dynamic arrays, redim preserve
    By pjjclark in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2007, 07:35 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1