+ Reply to Thread
Results 1 to 6 of 6

Don't understand error with Range()

  1. #1
    Registered User
    Join Date
    09-18-2007
    Posts
    7

    Don't understand error with Range()

    The code below hangs on the "If Not Intersect(Target, Range("A4:A" & Lastrow)) Is Nothing Then" line. I'm not sure why it's not taking it.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Does the variable Lastrow actually have anything in it? I'm not sure that the auto_open macro will have run when the workbook was opened.... I think it has to be in a general module. If you want the event, then it has to be on the workbook code sheet, and is workbook_open.


    rylo

  3. #3
    Registered User
    Join Date
    09-18-2007
    Posts
    7
    I moved

    Please Login or Register  to view this content.
    to the ThisWorkbook module, saved everything, closed it, opened it with macros enabled, and I'm still getting the error for the same line.

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Can you check that lastrow actually does have something in it, and what that number is.


    rylo

  5. #5
    Registered User
    Join Date
    09-18-2007
    Posts
    7
    Fixed it. :D

    I moved

    Please Login or Register  to view this content.
    into a standard code module (per http://www.cpearson.com/excel/codemods.htm)

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Achhhh

    Should have noticed that!!! Comes from looking at the code, not where the code would have been located.

    Must put that into my mental "thing to always check" list when reviewing code snips.


    rylo

+ 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