+ Reply to Thread
Results 1 to 6 of 6

User form RTE 13 when opening with a command button on a worksheet

  1. #1
    Registered User
    Join Date
    07-08-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    2

    User form RTE 13 when opening with a command button on a worksheet

    Hi,

    I have created a userform that allows users to enter data into a database spreadsheet. When I run a macro called showUserForm from the macro menu or from inside VBA the userform opens and runs properly.

    Please Login or Register  to view this content.
    However, I would like users to be able to open the userform from excel with the click of a button, without having to goto the macro menu, or press a combination of keys. When I add a command button to the worksheet I get a RTE 13 'type mismatch' when trying to open the user form. I have tried changing the name of the command buttons in the sheet and in the user form so they don't conflict but am having no luck. Any ideas?

    Here is the code for the button in the worksheet:
    Please Login or Register  to view this content.
    and from the userform:
    Please Login or Register  to view this content.
    Thanks!

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: User form RTE 13 when opening with a command button on a worksheet

    Try:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: User form RTE 13 when opening with a command button on a worksheet

    Try:
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: User form RTE 13 when opening with a command button on a worksheet

    Dang, I thought I was getting it done quickly. Not as quick as romperstomper though!

  5. #5
    Registered User
    Join Date
    07-08-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: User form RTE 13 when opening with a command button on a worksheet

    Solved! Thanks guys. What mistake was I making with my code?

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: User form RTE 13 when opening with a command button on a worksheet

    Unnecessary selection. It is almost never necessary to select anything in order to use it, and can get you in trouble. Since by default ActiveX buttons take focus when you click them, I suspect the Selection was not what your code needed it to be (a Range) but was still the button.

+ 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