# Trying to Password protected button to function



## loplop (Dec 15, 2022)

I finally got my button to be password protected, but I lost the function on it and can't figure it out for the live of me.
I want to be able to rest the count (where the 11 is) back to zero when you press reset skids.
here is the vba that I have
Private Sub CommandButton2_Click()
Dim MyPassword As String
    MyPassword = "zebra"
    If InputBox("Please enter password to continue.", "Enter Password") <> MyPassword Then
        Exit Sub
        End If

End Sub


----------



## Z51 (Dec 16, 2022)

If the area where your '11' appears is simply a merged cell, e.g. A1:G17, then you should be able to use:

```
Private Sub CommandButton2_Click()
Dim MyPassword As String
MyPassword = "zebra"
If InputBox("Please enter password to continue.", "Enter Password") <> MyPassword Then Exit Sub
Range("A1").Value = 0
End Sub
```


----------

