+ Reply to Thread
Results 1 to 7 of 7

how to link commandbuttons on userform

  1. #1
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    how to link commandbuttons on userform

    hi
    can commandbuttons be linked together to run a few with one click,i did commandbutton1_click,commandbutton2_click,commandbutton3_click,but this adds an extra line at the end of the sheet,it runs a combobox and textboxes can it be made to say if combobox is empty then exit
    cheers colin
    Last edited by cfinch100; 04-01-2013 at 12:31 PM.

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

    Re: how to link commandbuttons on userform

    Colin

    You could just move the code for all the command buttons into a separate sub and call that.

    It's easy to check if a combobox is empty and exit if it is.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: how to link commandbuttons on userform

    hi norie
    code has simalar to this do i need to swap this
    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

    cheers colin

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

    Re: how to link commandbuttons on userform

    Not sure what your asking.

  5. #5
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: how to link commandbuttons on userform

    hi
    the code you gave me would i swap with this one in mine or add another line
    Please Login or Register  to view this content.
    sorry prob did not explain properly
    cheers colin

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

    You shouldn't need to change anything.

    In the original code if ListIndex is -1 all the code in the If..End If block will be skipped.

    The next line of code after that block is End Sub...

  7. #7
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: how to link commandbuttons on userform

    hi
    thanks for that norie it works
    cheers colin

+ 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