+ Reply to Thread
Results 1 to 5 of 5

Define:Run-time error '1004'

  1. #1
    Registered User
    Join Date
    07-07-2006
    Posts
    4

    Define:Run-time error '1004'

    When I run my code every thing works ok, but it got error when the row number went up to 257 at the second red line. The error message is Run-time error '1004' Application-defined or object-defined error. I have value in cell A257 just like any other A cells. Nothing really funcy.

    rw(1) = 512
    rw(2) = 408
    Worksheets(wSheet(1)) = "template1'
    Worksheets(wSheet(2)) = "template2"

    Any one can help me on this?
    Thanks a million.

    John

    Here is the code:
    Please Login or Register  to view this content.
    Last edited by Johnyue; 01-02-2007 at 08:45 PM.

  2. #2
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Was looking through this... and I don't understand some of the code you have posted.

    You have a 'next cll' without a preceding 'for cll = ...' (That may be possible, but seems rather strange)

    You also seem to have variables coming out of nowhere (ie. jjj) that do not seem to be initialized, and it's hard to make a determination without knowing what values they contain.

    Also, iil gets initialized to 1 every time through the loop and then incremented to 2. If it itself is part of a loop, it's a different story, but the logic seems off.

    You're going to have to clarify some of these issues, unless someone sees something else that might be triggering the problem.

    Scott

  3. #3
    Registered User
    Join Date
    07-07-2006
    Posts
    4
    Hi Scott,
    I posted my full code now. Sorry for the comfusion.

    Thanks a million.

    John

  4. #4
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    I was staring at your code for a few minutes... then I realized your actual mistake was in the original bit you posted. I was just distracted by the other things that seemed odd.

    You've reversed the parameters to Cell(). "With Worksheets(wSheet(2)).Cells(1, j)" when j = 257 doesn't address A257, it addresses IW1.... which unfortunately doesn't exist. :-)

    That is, it's "Row, Column", not "Column, Row".

    Scott

  5. #5
    Registered User
    Join Date
    07-07-2006
    Posts
    4
    Quote Originally Posted by Maistrye
    That is, it's "Row, Column", not "Column, Row".

    Scott
    Scott,

    Thanks a million. Small concept cost me two days. Thank again.

    John

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1