+ Reply to Thread
Results 1 to 4 of 4

"Set Range" failing. Maybe I just need to take a break from it

  1. #1
    Registered User
    Join Date
    12-12-2007
    Posts
    15

    "Set Range" failing. Maybe I just need to take a break from it

    I've been plugging away at this pet project of mine for a few days, and for the life of me, I cannot get this one stupid little block of code to work:

    Please Login or Register  to view this content.
    I have 17 other subs running harmoniously with 36 worksheets, but "Set Range..." always manages to give me a problem. I clearly can't post thousands of lines of code or a 36-page workbook, so I will say that the "If" statement works; I can step through the code and the proper line will highlight depending on whether or not A1 is empty. I have startCell dimensioned as Range at the beginning of the Sub. I have tried Cells(1, 1) instead of Range with no luck. Maybe I'm just burning out and need to walk away from this for a few hours, but it's driving me crazy.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: "Set Range" failing. Maybe I just need to take a break from it

    did you declare startCell as range?

    Looks right to me. Easier if you can post the workbook

  3. #3
    Registered User
    Join Date
    12-12-2007
    Posts
    15

    Re: "Set Range" failing. Maybe I just need to take a break from it

    Ok, I ironed it out. Apparently I do need to take a break. The first error was generated by the next line to give startCell a value, which I managed to write wrong. The other error was from my forgetting how End(xlDown) works; with everything empty below A1, it never found another non-empty cell. I'm gonna go walk away from this for a little while. Thanks anyways.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: "Set Range" failing. Maybe I just need to take a break from it

    Try coming from the bottom up.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ 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