Set wks = wkb.Worksheets("Calendar") 'active worksheet wks.Cells(NextRow, 1) = ComboBox1.Value
I have this two lines of code with me. Here it gives me an
error number 1004 when I am going to assign the value of combobox to the worksheet’s(wks) first cell.
Let me know some resolution….
Runtime Error 1004 usually means that you are referring to an object that does not exist in your workbook.
As in your case
wks.Cells(NextRow, 1) = ComboBox1.Value
check the value of variable NextRow and make sure its greater than 0 to avoid the issue.
Also check wks workbook is valid workbook object.
This issue may occur if either of the following conditions is true:
- The Microsoft Visual Basic for Applications (VBA) macro copies and pastes one whole row in an Excel 2003 workbook.
- The Microsoft VBA macro copies and pastes a range of 2,516 rows or more rows in an Excel 2003 workbook.
The Runtime error 1004 means:
Runtime error 1004: Paste method of worksheet class failed. Runtime error 1004: Copy method of Range Class Failed.