The following tutorial shows how to protect/unprotect the excel sheet using macro
You have to pass the excel sheet name to the following functions to protect/unprotect the sheet
Code to fetch the sheet name:
ThisWorkbook.ActiveSheet.Name
Code to unprotect sheet
Public Sub Unprotect_Sheet(sname)
Sheets(sname).Unprotect Password:="password"
End Sub
Code to protect sheet
Public Sub Protect_Sheet(sname)
Sheets(sname).Protect Password:="password"
End Sub