• problems with subroutine (2007)

    Author
    Topic
    #453647

    I am having problems debugging a subroutine that I have inserted into a macro. I have used this subroutine many times before in different situations to fill down values or formulas, but for some reason when I inserted it into this macro it is giving a run-time 1004 error. Any help would be appreciated. I have attached a stripped down version of the spreadsheet and macro.

    Viewing 1 reply thread
    Author
    Replies
    • #1124179

      Try changing the line

      lLastRow = Cells(999999, iCol).End(xlUp).Row

      to

      lLastRow = Cells(Rows.Count, iCol).End(xlUp).Row

      • #1124183

        Hans, As soon as you sent the answer I realized that my friend was still using 2003. I should have realized that was the problem but I didn’t check the file extension. Thank you again for all of your help. The new version of this subroutine that you suggest will allow it to work in both versions.

        Thanks

    • #1124181

      Not sure if you are using 2007 version but I try it in 2003 version.
      I believe the line that cause the error is ” lLastRow = Cells(999999, iCol).End(xlUp).Row ”
      change it to “65536” instead if you are using versions other than 2007.

      Note: can’t help on 2007 version as I don’t have a copy of that.

      regards, francis

    Viewing 1 reply thread
    Reply To: problems with subroutine (2007)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: