K
Karen53
Hi,
My workbook is running. Now I'm trying to add my protection into the
sheets.
As a new item is added to the list on the main page, a new sheet is created
by copying a template and placing the appropriate formulas to link the new
sheet with the main page.
I add the unprotect/protect and the routine gives me a 1004 error.
When check my variable, it is correct.
I have tried this without setting the worksheet and with setting the
worksheet. I still get the same results. What baffles me is it works until
I add the protection. Is there something I don't understand? I need to add
the unprotect/protect in each routine, correct?
here's my code:
Sub SaveTenantName(Choice)
Dim ws As Worksheet
Set ws = MainPagepg
MainPagepg.Unprotect (MyPassword)
With ws
'save Tenants Name
With Cells(Choice, 6)
.NumberFormat = "General"
.Value = frmStoreData.txtTenantName.Value
End With
End With
MainPagepg.Protect ([MyPassword]), AllowFormattingCells:=True
End Sub
My workbook is running. Now I'm trying to add my protection into the
sheets.
As a new item is added to the list on the main page, a new sheet is created
by copying a template and placing the appropriate formulas to link the new
sheet with the main page.
I add the unprotect/protect and the routine gives me a 1004 error.
When check my variable, it is correct.
I have tried this without setting the worksheet and with setting the
worksheet. I still get the same results. What baffles me is it works until
I add the protection. Is there something I don't understand? I need to add
the unprotect/protect in each routine, correct?
here's my code:
Sub SaveTenantName(Choice)
Dim ws As Worksheet
Set ws = MainPagepg
MainPagepg.Unprotect (MyPassword)
With ws
'save Tenants Name
With Cells(Choice, 6)
.NumberFormat = "General"
.Value = frmStoreData.txtTenantName.Value
End With
End With
MainPagepg.Protect ([MyPassword]), AllowFormattingCells:=True
End Sub