+ Reply to Thread
Results 1 to 9 of 9

Run-time Error '91 ' ActiveX combobox

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Run-time Error '91 ' ActiveX combobox

    Hi.

    I have an ActiveX combobox, which takes data from a spreadsheet, in column 'E' and 'F'


    By typing a name NOT on my existing range, generates an error
    Run-time Error '91 ':
    The object variable or block variable 'With' is not defined
    how can I create a trap for this error?
    Thank you!

    Cross-Post
    http://www.mrexcel.com/forum/excel-q...-combobox.html
    Last edited by marreco; 08-15-2012 at 07:28 AM.
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Run-time Error '91 ' ActiveX combobox

    The trick in not to trap the error, but to avoid it to begin with. Show us the code.

    But to answer your requestion.

    Define a label. Point the error handler to that label. Code to correct.

    Please Login or Register  to view this content.
    Last edited by Tinbendr; 08-14-2012 at 09:28 AM.
    David
    (*) Reputation points appreciated.

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Run-time Error '91 ' ActiveX combobox

    Hi..
    This is code
    Please Login or Register  to view this content.

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Run-time Error '91 ' ActiveX combobox

    You probably need to test for F.Cells.Find(CB).Row before using it to populate Textbox1.

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Run-time Error '91 ' ActiveX combobox

    I tried to adapt but it did not work!

    see my file and help me please, thank you!
    Attached Files Attached Files

  6. #6
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Run-time Error '91 ' ActiveX combobox

    The code runs as written. No error. :P

    Try to save the file as a different filename and see if that fixes it. (I'm grabbing at straws here.)

  7. #7
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Run-time Error '91 ' ActiveX combobox

    Hi.

    if you type a name that does not exist in the combobox, the error occurred!

    Att

  8. #8
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Run-time Error '91 ' ActiveX combobox

    Try this.
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Run-time Error '91 ' ActiveX combobox

    Hi.

    Was great!!!

    thank you!!
    it's solved!!

+ 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