Closed Thread
Results 1 to 3 of 3

Wanting to write results to array instead of sheet, results overwriting....

  1. #1

    Wanting to write results to array instead of sheet, results overwriting....

    Hi y'all

    I have a problem, i have the following sub:

    Sub PrintIt()

    Range(Cells(9, 2 + Col), Cells(8 + UBound(b, 1), 2 + Col)).Value =
    b
    Col = Col + 1

    End Sub


    However I want vba to write the results not in the defined range but in
    an array. However if I change the above sub in the following:

    Sub PrintIt()

    IntermediateArray = b
    Col = Col + 1

    End Sub

    I get that the code overwrites itself and i only get one line of
    results. does anybody know how I can rewrite the code so it gets the
    same results only inside an array instead of written on a sheet?

    thanks a lot!

    rgds, Sarju


  2. #2
    Tom Ogilvy
    Guest

    Re: Wanting to write results to array instead of sheet, results overwriting....

    If "b" is a 2D array and IntermediateArray is dim'd as Variant, then
    IntermediateArray should be identical to the "b" array.

    --
    Regards,
    Tom Ogilvy

    <[email protected]> wrote in message
    news:[email protected]...
    > Hi y'all
    >
    > I have a problem, i have the following sub:
    >
    > Sub PrintIt()
    >
    > Range(Cells(9, 2 + Col), Cells(8 + UBound(b, 1), 2 + Col)).Value =
    > b
    > Col = Col + 1
    >
    > End Sub
    >
    >
    > However I want vba to write the results not in the defined range but in
    > an array. However if I change the above sub in the following:
    >
    > Sub PrintIt()
    >
    > IntermediateArray = b
    > Col = Col + 1
    >
    > End Sub
    >
    > I get that the code overwrites itself and i only get one line of
    > results. does anybody know how I can rewrite the code so it gets the
    > same results only inside an array instead of written on a sheet?
    >
    > thanks a lot!
    >
    > rgds, Sarju
    >




  3. #3
    Vacation's Over
    Guest

    RE: Wanting to write results to array instead of sheet, results overwr

    you are only getting one result because you do not cycle through col values


    For col = 1 to 'whatever

    ''''YOURCODEHERE
    ''drop your col = col + 1 line
    next col

    "[email protected]" wrote:

    > Hi y'all
    >
    > I have a problem, i have the following sub:
    >
    > Sub PrintIt()
    >
    > Range(Cells(9, 2 + Col), Cells(8 + UBound(b, 1), 2 + Col)).Value =
    > b
    > Col = Col + 1
    >
    > End Sub
    >
    >
    > However I want vba to write the results not in the defined range but in
    > an array. However if I change the above sub in the following:
    >
    > Sub PrintIt()
    >
    > IntermediateArray = b
    > Col = Col + 1
    >
    > End Sub
    >
    > I get that the code overwrites itself and i only get one line of
    > results. does anybody know how I can rewrite the code so it gets the
    > same results only inside an array instead of written on a sheet?
    >
    > thanks a lot!
    >
    > rgds, Sarju
    >
    >


Closed Thread

Thread Information

Users Browsing this Thread

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

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