+ Reply to Thread
Results 1 to 9 of 9

Unable to launch userform from button on worksheet

  1. #1
    Registered User
    Join Date
    06-13-2015
    Location
    arizona
    MS-Off Ver
    2007
    Posts
    4

    Unable to launch userform from button on worksheet

    Hey guys,

    Trying to launch a form from a button on a worksheet but unable to do it, I already have the userform setup where it automatically launches when i open a workbook, however if the userform is closed the users have to then launch it though the developer tab which a lot of them dont know how..So i decided to put a button on the wrksheet to launch it but it does not launch, get a debug error...

    this workbook has a code

    Private Sub Workbook_Open()
    UserForm1.Show
    End Sub


    And in my main user for i have this code

    Private Sub UserForm_Initialize()
    With Sheets("Database").Range("A3", Cells(Rows.Count, "A").End(xlUp))
    partner = Application.Transpose(.Value2)
    End With

    Me.ComboBox1.List = partner

    End Sub

    Help
    Last edited by savferns01; 01-14-2016 at 03:53 AM.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Unable to launch userform from button on worksheet

    Depends on which type of "button".
    If it's a "Form Control", create a small macro in a standard module with something like:

    Please Login or Register  to view this content.
    Then assign that macro to the button.

    If it's an "ActiveX Control", place the button then double click on it (in Design Mode) to bring up the VB Editor. Add UserForm1.Show to that code and away you go.

    That doesn't necessarily avoid the debug error. Could you tell us which error exactly you get and which line it highlights when you press debug?
    Or even better, attach a sample workbook with the error.

    BSB

  3. #3
    Registered User
    Join Date
    06-13-2015
    Location
    arizona
    MS-Off Ver
    2007
    Posts
    4

    Re: Unable to launch userform from button on worksheet

    Hey BSB,

    thanks for the reply...already tried that bud..added a module and used code

    Sub ShowForm()
    UserForm1.Show
    End Sub

    but it get the error

    "runtime error '1004'

    application -defined or object defined error"

    and when I hit debug userform1.show in the module gets highlighted

    and directs it to

    Private Sub UserForm_Initialize()
    With Sheets("Database").Range("A3", Cells(Rows.Count, "A").End(xlUp))

    (HERE IS WHERE IT PROMPTS THE DEBUG ERROR)

    partner = Application.Transpose(.Value2)
    End With

    Me.ComboBox1.List = partner

    End Sub

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Unable to launch userform from button on worksheet

    Could we see the workbook? Desensitize any confidential information.

    BSB

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Unable to launch userform from button on worksheet

    Does the userform launch successfully from the workbook open event?

    BSB

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to launch userform from button on worksheet

    Could you please use code tags?
    If posting code please use code tags, see here.

  7. #7
    Registered User
    Join Date
    06-13-2015
    Location
    arizona
    MS-Off Ver
    2007
    Posts
    4

    Re: Unable to launch userform from button on worksheet

    BSB,

    yeah the userform launches perfect when i open the workbook...however if the userform is closed then need a way to quickly launch the userform without the user having to go into tyhe developer tab

    * Norie..

    Sorry about the posts will use code tags going forward

  8. #8
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Unable to launch userform from button on worksheet

    I think we'll need to see the workbook. Far easier to diagnose that way.

    BSB

  9. #9
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Unable to launch userform from button on worksheet

    Try properly qualifying your ranges:
    Please Login or Register  to view this content.

+ 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. [SOLVED] userform button is depressed and unable to get it to go back to normal.
    By CtrlAltDelete in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2014, 12:17 PM
  2. Launch application by command button on excel vba userform
    By Benjamin2008 in forum Excel General
    Replies: 1
    Last Post: 12-20-2013, 05:15 PM
  3. Unable to launch VSTO add-in
    By cb366374 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-04-2013, 09:08 PM
  4. [SOLVED] EXCEL USERFORM- Unable to print spreadsheet using command button
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-19-2013, 10:26 AM
  5. [SOLVED] Launch a userform from toolbar instead of command button
    By Clare Smyth in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2013, 12:17 PM
  6. How to launch macro or other userform after command button.
    By Karkas in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-06-2009, 08:49 PM
  7. Macro launch - Button vs Manual launch , has different results.
    By Wayne in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2005, 08:06 AM

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