How to use a Command Button inserted in the Spreadsheet in VBA code?

2

I have a command button that I inserted into a worksheet, and I wanted to know which function I have to assign in the vba code, to know when a user clicks it!

    
asked by anonymous 10.02.2016 / 19:07

3 answers

1
  • If it is an Active-x Active-X Controls button double-click the button and it will open a Sub to create your code in VBA.

  • If it is a common Form Controls button, you can create your macro and then right click on the button, select the Assign macro ... , select your macro and have your button perform the function you want.

  • I hope I have helped!

        
    10.02.2016 / 20:19
    2

    On the click counter, you can make it disappear in any cell when the user clicks the button. For example:

    Sub Button1_Click()
    
    Sheet1.Cells(1, 1).Value = Sheet1.Cells(1, 1).Value + 1
    
    End Sub
    

    Surely you will find more effective ways to do this, but this is the simplest as far as I know!

        
    11.02.2016 / 19:05
    1

    Good morning,

    I was able to resolve using the ActiveX button, when someone clicks on it, it assigns a variable that enables a specific worksheet.

    Thanks to everyone for the collaboration.

        
    19.02.2016 / 13:08