I have a Command button in my Worksheet ("Sheet1")
, under a Table.
My sheet is protected and I need let user add new rows.
Bellow macro was wrote for do that: (This is in a WorkSheet module)
Sub TblNewLine(Sht As String, Tbl As String, Pass as String, Filtering As Boolean, Pivot As Boolean)
if Nor Pass = vbNullString then
Dim strP as String
strP = InputBox ("Please input Password","Password")
if Not strP = Pass Then
if not strP = vbNullString Then MsgBox "Wrong Password!", vbCritical, "Error!"
Exit Sub
End If
End If
Sheets(Sht).Unprotect
Sheets(Sht).ListObjects(Tbl).ListRows.Add
Sheets(Sht).Protect AllowFiltering:=Filtering, AllowUsingPivotTables:=Pivot
End Sub 'TblNewLine
for example: arguments are:
sht:= "sheet1", Tbl:="PvtReport", Pass:="", Filtering:=True, Pivot:= True
Thus I need assign this macro to prepared command button that is under Table.
And passing arguments with pressing button.
In assign macro form, I cant find above macro in Macro names combo box.
How can I assign above macro and its related arguments to a command button?
Or is there any better solution for Insert new row to protected sheet Table?