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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -