Excel VBA Object Defined Error -
i getting object defined error below code. any idea doing wrong? thanks
sub loop_test2() dim integer dim j integer dim countall integer dim countxl integer activesheet.range("a1").activate countall = activesheet.range("a35") msgbox countall j = 1 countall = 1
this error occurs:
countxl = cells(i, j).value
continued:
msgbox countxl = 1 countxl + 2 cells(i + 2, j) = "row " & & " col " & j next next j end sub
i think incorrect assignment. i'm not familiar correct syntax.
error details: "run time error 1004. application defined or object defined error
before edit question, forget initial i
.so set value i
.
in future, may use option explicit
@ top of sub make sure declare variable before using it.
so case, need set i=1
, , please declare variables long instead of integer. may refer here find out reason why use long instead of integer.
Comments
Post a Comment