Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Location
    Bloomington, Indiana, USA
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problems with subroutine (2007)

    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.
    Attached Files Attached Files
    Greg <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: problems with subroutine (2007)

    Try changing the line

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

    to

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

  3. #3
    3 Star Lounger
    Join Date
    Nov 2005
    Location
    Asia Pacific, Bangkok Metropolis
    Posts
    378
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: problems with subroutine (2007)

    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
    Hope this is helpful

    francis, <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    My Reading

    Pivot Table 101
    Pivot Table
    Array

  4. #4
    Star Lounger
    Join Date
    Aug 2001
    Location
    Bloomington, Indiana, USA
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: problems with subroutine (2007)

    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
    Greg <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

Posting Permissions

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