help with printing to cells

Orongo

Board Regular
Joined
Nov 6, 2011
Messages
83
Hi, for some reason my command to write to cells("A1:D3") is not working with (toPrint is a Variant)

Worksheets("show").Range(Cells(1.1), Cells(3, 4)).Value = toPrint

so I have now made a loop to force the macro to write out toPrint like

Sub Write2Sheet(toPrint As Variant, position As Variant, sheet As String)
Dim iRow As Integer, iCol As Integer, i As Integer, j As Integer
iRow = position(0)
iCol = position(1)

For i = 1 To UBound(toPrint, 1)
For j = 0 To UBound(toPrint, 2)
Set Worksheets("show").Range(Cells(iRow, iCol), Cells(iRow + i, iCol + j)).Value = toPrint(i, j)
Next j
Next i

Both the tries have generated the same error "Run-time error '1004' - Application-defined or object-defined error". What is that I dont see? it feels so stupid, and I'm sure its something data defined. Please tell me what have been me sleepless during the night.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top