+ Reply to Thread
Results 1 to 4 of 4

Error - Object variable not set (Error 91)

  1. #1
    Registered User
    Join Date
    10-21-2010
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Error - Object variable not set (Error 91)

    Hi everybody Nice to meet you. I need some help with VBA.

    I have worksheet, like this:

    http://radikal.ru/F/s15.radikal.ru/i...03dc3.jpg.html

    I have day-list. When i choose a day from this list, Excel should take me to another cell. This cell is ilustrated on third picture - column AK.

    http://radikal.ru/F/s59.radikal.ru/i...e331f.jpg.html

    http://radikal.ru/F/i061.radikal.ru/...3a719.jpg.html

    But when I choose day on list I have this error:

    Object variable not set (Error 91)

    When I click Debug button Escel shows me, that this line is wrong in VBA:

    Please Login or Register  to view this content.
    This is my all code for this function:

    Please Login or Register  to view this content.
    What I do wrong ??

    P.S. My sheets have to be protect in Excel.

    Thanks for any help.
    Last edited by Przemyslav; 10-21-2010 at 03:25 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Error - Object variable not set (Error 91)

    Hello Przemyslav,

    Welcome to the Forum!

    This is a very common problem for beginners using the Find method in VBA. You need to use a range object variable to hold the result of the find operation. If successful then the object points to the cell where the match was found. If no match is made then the object variable is set to the special object value of Nothing. The object variable needs to be checked to decide what action needs to be taken.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    10-21-2010
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Error - Object variable not set (Error 91)

    Thanks Leith Ross for your help

    I will be remember your advice

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Error - Object variable not set (Error 91)

    Hello Przemyslav,

    If this solution solved your problem, please mark the thread as solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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