[Solved] VBA : Remove private Sub or Command Button

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • Good Morning,


    I would like to know if it is possible to have a command button to be deleted or hidden after the command has been executed. Or is it possible to delete a private sub.


    Thanks


    :yes::yes:

  • You can just include one line in the code for that button to make it hidden.


    Private Sub CommandButton1_Click()
    CommandButton1.Visible = False
    End Sub


    HTH

    Thanks: ~Yogendra

  • Quote

    Originally posted by yjoshi
    You can just include one line in the code for that button to make it hidden.


    Private Sub CommandButton1_Click()
    CommandButton1.Visible = False
    End Sub


    HTH


    That will do the trick


    Thanks;;);;)

  • Quote

    Originally posted by yjoshi
    You can just include one line in the code for that button to make it hidden.


    Private Sub CommandButton1_Click()
    CommandButton1.Visible = False
    End Sub


    HTH


    Question how do you show back the command button the next time the workbook is open?


    Thanks:barf:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!