L
LiAD
Hi,
I am using the macro attached below to drive a series of worksheets, graphs
etc. I would like to change the protect and unrpotect sheet parts to
protect/unp the whole workbook as that will also lock the sheet tab names.
Could somebody tell me how please? When I try I get loads an error
Thanks
LiAD
Sub BobineProduit15()
Sheets("UP1 Production").Unprotect Password:="ABCDEF"
Sheets("UP4 Données").Unprotect Password:="ABCDEF"
Call AddToLog("BobineProduit15")
If myT = 0 Then myT = Now
With Sheet4
If Now - myT > 1 / 1440 Then 'Note - use 1440 (60*24), not 14400
..Range("L6").Value = 0
Else
..Range("L6").Value = .Range("L6").Value + 1
End If
myT = Now
End With
'Add 1 to I38
With Sheet1
If IsNumeric(.Range("J38").Value) Then
..Range("J38").Value = .Range("J38") + 1
Else
MsgBox "J38 on sheet1 isn't a number!"
End If
End With
Sheets("UP1 Production").Protect Password:="ABCDEF"
Sheets("UP4 Données").Protect Password:="ABCDEF"
End Sub
Sub AddToLog(MacName As String)
Sheets("Log").Unprotect Password:="ABCDEF"
Dim NextRow As Long
With Worksheets("Log")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, "A").Value = MacName
.Cells(NextRow, "B").Value = Now
End With
Sheets("Log").Protect Password:="ABCDEF"
End Sub
I am using the macro attached below to drive a series of worksheets, graphs
etc. I would like to change the protect and unrpotect sheet parts to
protect/unp the whole workbook as that will also lock the sheet tab names.
Could somebody tell me how please? When I try I get loads an error
Thanks
LiAD
Sub BobineProduit15()
Sheets("UP1 Production").Unprotect Password:="ABCDEF"
Sheets("UP4 Données").Unprotect Password:="ABCDEF"
Call AddToLog("BobineProduit15")
If myT = 0 Then myT = Now
With Sheet4
If Now - myT > 1 / 1440 Then 'Note - use 1440 (60*24), not 14400
..Range("L6").Value = 0
Else
..Range("L6").Value = .Range("L6").Value + 1
End If
myT = Now
End With
'Add 1 to I38
With Sheet1
If IsNumeric(.Range("J38").Value) Then
..Range("J38").Value = .Range("J38") + 1
Else
MsgBox "J38 on sheet1 isn't a number!"
End If
End With
Sheets("UP1 Production").Protect Password:="ABCDEF"
Sheets("UP4 Données").Protect Password:="ABCDEF"
End Sub
Sub AddToLog(MacName As String)
Sheets("Log").Unprotect Password:="ABCDEF"
Dim NextRow As Long
With Worksheets("Log")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, "A").Value = MacName
.Cells(NextRow, "B").Value = Now
End With
Sheets("Log").Protect Password:="ABCDEF"
End Sub