Code: Select all
Private Sub CommandButton1_Click()
ActiveWorkbook.Protect PassWord:="", Structure:=False, Windows:=False
Sheets("Summary").Unprotect ""
Sheets("Summary Texas").Unprotect ""
Sheets("Summary").Range("A1").Value = Range("B23").Value
Sheets("Summary Texas").Range("A1").Value = Range("B23").Value
Sheets("Summary").Range("A2").Value = " Date of Inspection: " & Range("E6").Value
Sheets("Summary Texas").Range("A2").Value = " Date of Inspection: " & Range("E6").Value
Sheets("Summary").Range("A3").Value = " Inspection Address: " & Range("B30").Value
Sheets("Summary Texas").Range("A3").Value = " Inspection Address: " & Range("B30").Value
Sheets("Client_info").Visible = xlSheetHidden
Sheets("Summary").Protect DrawingObjects:=False, Contents:=True, Scenarios:=True, _
PassWord:="", UserInterfaceOnly:=True
Sheets("Summary Texas").Protect DrawingObjects:=False, Contents:=True, Scenarios:=True, _
PassWord:="", UserInterfaceOnly:=True
ActiveWorkbook.Protect PassWord:="", Structure:=True, Windows:=True
UserForm2.Show
End Sub
I tried changing some of the code with using this approach with no such luck, any suggestions would be greatly appreciated.
Code: Select all
Dim sht As Worksheet
For Each sht In Sheets(Array("Summary", "Summary Texas"))
sht.UnProtect Password:=""
Next sht
For Each sht In Sheets(Array("Summary", "Summary Texas"))
sht. Protect DrawingObjects:=False, Contents:=True, Scenarios:=True, _
PassWord:="", UserInterfaceOnly:=True Next sht
Code: Select all
Application.ScreenUpdating = True
Application.ScreenUpdating = False