+ Reply to Thread
Results 1 to 3 of 3

Error #91 Object Variable or With Block Not Set

  1. #1
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Oxford
    MS-Off Ver
    Excel 2003, 2007 and 2010
    Posts
    120

    Question Error #91 Object Variable or With Block Not Set

    Hey All,

    I have a Piece of code that when a form is initialised it runs. I Want the code to find if there is a value in the current cell selected and if there is load the form if not dont load the form.

    This is the code that i have produced:

    Please Login or Register  to view this content.
    The Problem is that it works fine if the "Unload PRICE_CHANGE" isnt in there but the error #91 "Object Variable or With Block Variable not Set"

    I have tried a number of ways to overcome it but just cant get it to work.

    any help will be great. Thanks

    Tom

  2. #2
    Forum Contributor
    Join Date
    04-16-2009
    Location
    Dorset, UK
    MS-Off Ver
    Office 2003, Office 2007
    Posts
    131

    Re: Error #91 Object Variable or With Block Not Set

    What is PRICE_CHANGE and why are you trying to unload it?

    This error basically meant that VBA has no idea what object you're trying to do things to!

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

    Re: Error #91 Object Variable or With Block Not Set

    Hello Tom,

    Move your code from the UserForm_Initialize() event to the UserForm_Activate() event code module.
    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!)

+ 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