Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error 1004
Hi,
Can anyone please help with the following: 1004 Application-defined or object-defined error. ....... lots of code xstart = "555" For j = 1 To nump Debug.Print Worksheets("Sheet2").Cells(j, 1).Value, xstart Worksheets("Sheet2").Cells(j, 1).Value = xstart ....... lots more code The debug.print prints the correct values from the spreadsheet and the program variable. It gives the error on the next line when trying to set the value. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error 1004
The little snippet of code you pasted worked ok for me (after adding some
declares and initializing variables). Are you running xl97 and calling the code using a control from the control toolbox toolbar. If that's the case, change the .takefocusonclick property to false for that control. If it doesn't have that property, add this line to the top of your code: Tigger wrote: Hi, Can anyone please help with the following: 1004 Application-defined or object-defined error. ...... lots of code xstart = "555" For j = 1 To nump Debug.Print Worksheets("Sheet2").Cells(j, 1).Value, xstart Worksheets("Sheet2").Cells(j, 1).Value = xstart ...... lots more code The debug.print prints the correct values from the spreadsheet and the program variable. It gives the error on the next line when trying to set the value. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error 1004
Dave,
Thanks for your reply. I have fixed the problem. Your mention of 'running' the code triggered the solution. This code was originally run as a VB script. I cut/pasted it into VBA as a FUNCTION - hence I cannot modify a cell etc. Duh!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Run time error 1004 General ODCB Error | Excel Programming | |||
Application Run Time Error 1004 and Stack Error | Excel Programming | |||
Interior class error/runtime error 1004 | Excel Programming |