You don't need this in the Private code.
Rather, put this in the general Module:
Code:
Sub CommandButton1_Click()
Dim i As Integer
ActiveSheet.Unprotect
For i = 1 To 10
Range("a" & i).Value = "This is a test " & i
Next i
ActiveSheet.Protect
End Sub
Then assign this macro to the commandbutton. If you want to have it password protected, then add appropriate items.
I tried this and it works fine.