Tuesday, 15 May 2012

excel - VBA Run-time error '1004': Application-defined or object-defined error -



excel - VBA Run-time error '1004': Application-defined or object-defined error -

i cannot find problem in code, results in error. trying alter formula of cell (l), if cell (j) not empty. want to run , check rows 6 69.

sub tmark() x = 6 set r = sheet1.range("jx") if not isempty(r.value) sheets("sheet1").range("lx").formula = "=(+jx-fx)*dx" end if x = x + 1 loop until x = 70 end sub

excel treating "jx" string rather j6. should set ("j" & x).

also setting x = 6 within loop, x never increments beyond 6 , loop continues run forever.

sub tmark() dim x long dim r range x = 6 set r = sheet1.range("j" & x) if not isempty(r.value) sheets("sheet1").range("l" & x).formula = "=(+j" & x & "-f" & x & ")*d" & x end if x = x + 1 loop until x = 10 end sub

excel vba runtime-error

No comments:

Post a Comment