+ Reply to Thread
Results 1 to 7 of 7

Object Required Error on Command Button Click

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Object Required Error on Command Button Click

    All,

    I'm trying to get the selected items from a listbox in a userform to be transferred to a sheet in the Excel workbook. The listbox is single select. I get an "Object required" error on the specified line below and I can't seem to figure out why it is throwing that error. I specified both the sheet and listbox item. Any ideas? Below is my command button code:

    Please Login or Register  to view this content.
    When I hover over "me.lbLeft.List(i)" it returns the value that I want. My sheet name is correct. I'm not sure what the issue is, any help would be appreciated.

    Thanks.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Object Required Error on Command Button Click

    Is that the code name of the sheet, or the worksheet name?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Object Required Error on Command Button Click

    That's the code name of the sheet.

  4. #4
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Object Required Error on Command Button Click

    It has something to do with my sheet variable. I modified my code to the below and it worked perfectly. The only issue is I need my sheet to be a variable that is specified by the user prior to the form opening. Any suggestions?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Object Required Error on Command Button Click

    Quote Originally Posted by jsmilke View Post
    It has something to do with my sheet variable. I modified my code to the below and it worked perfectly. The only issue is I need my sheet to be a variable that is specified by the user prior to the form opening. Any suggestions?

    Please Login or Register  to view this content.
    I changed "shMapping" to "Sheets(6)"

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Object Required Error on Command Button Click

    You could have them select the sheet where they want the result to appear first, then write to the active sheet.

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Object Required Error on Command Button Click

    In your original code I don't see something that sets the shMapping object, and from your comments I see the user specifies it. Is it a global variable? or is it part of a macro that runs before the form is loaded? I suspect the shMapping sheet object is not available to the userform.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 05-19-2016, 04:34 AM
  2. Replies: 2
    Last Post: 08-07-2014, 03:14 PM
  3. Replies: 1
    Last Post: 05-07-2014, 07:05 AM
  4. use a command button to click other command buttons
    By fcharl9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2013, 08:48 PM
  5. [SOLVED] Object Required Error - Need to modify button
    By jeff_kaufman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2013, 12:19 PM
  6. Application Defined or Object Defined Error, Command Button and Vlookup Function
    By stevedomer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-14-2011, 11:20 PM
  7. Object required error on CommandButton Click
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-09-2011, 06:05 PM

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