I have some Excel VBA code which generates an array based on inputs/calculations and then enters the values onto another sheet.
I have this working for one version of my spreadsheet which contains all of the calculations on one sheet using:
Range(Cells(4, "T"), Cells(4 + ball, "T")).Value = Application.Transpose(lon)
However, when I try to use this on another workbook which enters the values onto another sheet in the same location using:
Sheets("Calculations").Range(Cells(4, "T"), Cells(4 + ball, "T")).Value = Application.Transpose(lon)
I get an error stating: "Run-time error '1004': Application-defined or object-defined error". I have looked this up and also doing some debug.print of values in my array to ensure I understand the values and the length, believe my issue is with how I am declaring the range. However, I cannot seem to figure out the correct implementation.
As a work-around I have a For loop pasting the values into the cell but it seems to me there would be a cleaner way to do this.
For n = 1 To ball
Sheets("Calculations").Cells(4 + n, "T").Value = lon(n)
Next n
Thanks for your help!