Thread: Error 1004
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default 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