Reputation: 5
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....
Advance Thanks....
Upvotes: 1
Views: 1255
Reputation: 12353
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.
Upvotes: 2
Reputation: 54260
This issue may occur if either of the following conditions is true:
The Runtime error 1004 means:
Runtime error 1004: Paste method of worksheet class failed.
Runtime error 1004: Copy method of Range Class Failed.
Reference: http://support.microsoft.com/kb/905164
Upvotes: 1