Hi all, newbie here.
I'm trying to copy a row of cells from one sheet (Sheet1) to the first empty cell in column 2 on another sheet (Sheet2) using a checkbox.
Here is my code:
If CheckBox2.Value = True Then
Dim xCell As Range
Worksheets("Sheet1").Range("A9:K9").Copy
' On Error Resume Next
For Each xCell In Sheets("Sheet2").Columns(2).Cells
If Len(xCell) = 0 Then
Worksheets("Sheet2").Range(xCell).PasteSpecial Transpose:=True
Exit For
End If
Next
End If
The error message I get at line beginning with Worksheets("Sheet2"). is
"Application-defined or object-defined error"
Could someone give me a hint as to what I'm doing wrong.
Many thanks.
I'm trying to copy a row of cells from one sheet (Sheet1) to the first empty cell in column 2 on another sheet (Sheet2) using a checkbox.
Here is my code:
If CheckBox2.Value = True Then
Dim xCell As Range
Worksheets("Sheet1").Range("A9:K9").Copy
' On Error Resume Next
For Each xCell In Sheets("Sheet2").Columns(2).Cells
If Len(xCell) = 0 Then
Worksheets("Sheet2").Range(xCell).PasteSpecial Transpose:=True
Exit For
End If
Next
End If
The error message I get at line beginning with Worksheets("Sheet2"). is
"Application-defined or object-defined error"
Could someone give me a hint as to what I'm doing wrong.
Many thanks.