ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wanting to write results to array instead of sheet, results overwriting.... (https://www.excelbanter.com/excel-programming/344250-wanting-write-results-array-instead-sheet-results-overwriting.html)

[email protected]

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


Tom Ogilvy

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

wrote in message
oups.com...
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




Vacation's Over

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

" 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




All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com