Microsoft® Excel® based database addin

 

+ Reply to Thread
Results 1 to 3 of 3

Thread: (no subject)

  1. #1
    John Guest

    Default (no subject)

    I want to save multiple possibilities for a range and be able to pop one
    back into the range. Is there a way to do this other than saving the
    ranges to an array? Can't use copy, paste because there are more than one.

    Have Myrange = (Cells(1,1),cells(70,70))

    then have 6 different versions of myrange.

    thanks
    John

  2. #2
    Bob Bridges Guest

    Default RE: (no subject)

    Well, depending on the objection you have to an array, maybe a collection
    would work better for you. In fact, now that a more experienced programmer
    has explained collections to me, I think they're better for this purpose:
    You don't have to have any idea ahead of time how many you'll need to store,
    and you can label them by a string or a sequential index, whichever works
    better for you. (In fact, you can use both at once.) You can create the
    Range object and Add it to your collection...though I think you can store
    objects in arrays, too, so that isn't really an advantage of collections over
    arrays.

    But then, you're still storing the ranges one by one and pulling them back
    one by one, and in that sense a collection isn't that different from an
    array. What do you already know about collections, and if you know about
    them, how are you hoping to improve on both them and arrays?

    --- "John" wrote:
    > I want to save multiple possibilities for a range and be able to pop one
    > back into the range. Is there a way to do this other than saving the
    > ranges to an array? Can't use copy, paste because there are more than one.
    >
    > Have Myrange = (Cells(1,1),cells(70,70))
    >
    > then have 6 different versions of myrange.


  3. #3
    Bob Bridges Guest

    Default RE: (no subject)

    Well, depending on the objection you have to an array, maybe a collection
    would work better for you. In fact, now that a more experienced programmer
    has explained collections to me, I think they're better for this purpose:
    You don't have to have any idea ahead of time how many you'll need to store,
    and you can label them by a string or a sequential index, whichever works
    better for you. (In fact, you can use both at once.) You can create the
    Range object and Add it to your collection...though I think you can store
    objects in arrays, too, so that isn't really an advantage of collections over
    arrays.

    But then, you're still storing the ranges one by one and pulling them back
    one by one, and in that sense a collection isn't that different from an
    array. What do you already know about collections, and if you know about
    them, how are you hoping to improve on both them and arrays?

    --- "John" wrote:
    > I want to save multiple possibilities for a range and be able to pop one
    > back into the range. Is there a way to do this other than saving the
    > ranges to an array? Can't use copy, paste because there are more than one.
    >
    > Have Myrange = (Cells(1,1),cells(70,70))
    >
    > then have 6 different versions of myrange.


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