+ Reply to Thread
Results 1 to 7 of 7

Command button to hide when selected and to show another button on a different userform

  1. #1
    Registered User
    Join Date
    08-22-2017
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    4

    Command button to hide when selected and to show another button on a different userform

    I have been crash coursing myself in macro and vba learning alot and getting frustrated alot. This forum has been a life saver!!

    Currently I am creating a workbook with multiple user forms. I have one form with multiple buttons called caravalibility and a matching form called returningloaner. Right now i have them to where if both are open and i choose a button (fiftytwo) on the caravalibility form it will show the same button (fiftytwoin) on returningloaner. the problem i have is that the forms do not hold memory on the button visibility so once the form is closed and reopened all the buttons on both forms are visible. here is a saple of what i have written for the codes.

    Capturecaravalibility.PNG

    Capturereturningloaner.PNG


    any bit of insight and teaching would be huge..

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Command button to hide when selected and to show another button on a different userfor

    Do you need to unload the userform, or can you just hide it?

  3. #3
    Registered User
    Join Date
    08-22-2017
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    4

    Re: Command button to hide when selected and to show another button on a different userfor

    I think i just want to hide the form after clicking the button.
    I am not 100% sure as of yet. Due to the fact that this is actually the very first time building userform. So any suggestions are welcome.

    The idea of the work book is to

    1) Fill a work sheet with information
    2) Cut time filling out the worksheet
    3) Be very user friendly
    4) Insure that required fields are filled
    5) Automatically keep a running sheet of information on Inputs

  4. #4
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Command button to hide when selected and to show another button on a different userfor

    Here is what I came up with... It uses boolean to store what is visible and what is not visible... It will store the information while the workbook is opened but as soon as the sheet is closed it will reset all the buttons back to default

    This should be able to be adapted to what you need.


    Let me know what you think
    Attached Files Attached Files
    Bramz

  5. #5
    Registered User
    Join Date
    08-22-2017
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    4

    Re: Command button to hide when selected and to show another button on a different userfor

    meabrams,
    Thank you for the input! I am sure down the road this will help with other userforms i will be building for this work sheet. What i am looking to do is opposite of what you have there. Also the way i have it set up it holds the information on the forms until the work book is closed and opened again...

    Quite possibly what I am looking to do is have the userform search a work sheet and determine "if" a cell has contents then the button will not be visible but if false they will be visible. I will keep attempting to get at least one of my buttons working as i wish.


    Thanks for the info and any future info

  6. #6
    Registered User
    Join Date
    08-22-2017
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    4

    Re: Command button to hide when selected and to show another button on a different userfor

    UPDATE:

    So I have it working properly and now curious if there is a way for the work book to keep a memory of the visibility of the buttons when the work book is closed and opened??
    Last edited by markdaflm; 08-31-2017 at 10:55 AM.

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Command button to hide when selected and to show another button on a different userfor

    .visibility=true
    .visibility=false

    Probably the same as 1 for true, or 0 for false

    If you have a cell with 0 or 1 then one would think,
    ie:A1 in sheet1
    Please Login or Register  to view this content.
    so somewhere in the userform, you will have to set A1 to a 1 or 0

+ 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] How to hide and show userform and werksheet with Toggle Nutton and Command Button
    By DawidV in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-26-2017, 07:22 AM
  2. [SOLVED] Need macro to show or hide columns using a command button
    By Grilleman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2016, 08:59 AM
  3. Replies: 2
    Last Post: 02-02-2016, 10:27 PM
  4. [SOLVED] How to update Quantity with combobox1 selected Product in userform using command button
    By svgopalareddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2015, 05:03 AM
  5. Userform Option Button to Show/Hide Another Option Button on same Userform
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2010, 09:44 AM
  6. [SOLVED] Hide/Show Command button based on cell value
    By paxile2k in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2010, 08:59 AM
  7. command button on/off (show/hide)
    By gobbolino in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2007, 10:35 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