[Solved] VBA : Remove private Sub or Command Button

  • 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!