Private Sub Worksheet_Protect()
ActiveSheet.Protect
End Sub
Private Sub CommandButton1_Click()
Dim slogin As String
Dim spassword As String
slogin = InputBox("Enter full name here!")
If slogin = "" Then
MsgBox "You must enter your full name!"
slogin = InputBox("Enter full name here!")
End If
spassword = InputBox("Enter password here!")
If spassword = "" Then
MsgBox "You must enter the password!"
spassword = InputBox("Enter password here!")
End If
If spassword = "brownforman" Then ActiveSheet.Unprotect
'Begin Registry setting
'"appname:=" = Desired name you create, variable or string, preferred a string
'"section:=" = Desired name you create, variable or string
'"Key:=" = Desired name you create, variable or string
'setting:=" = variable or string
SaveSetting appname:="AppNameHere", section:="SectionNameHere", _
Key:="Login", setting:=slogin
'End registry setting
End Sub
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim V As Long
Dim sUser As String
Application.EnableEvents = False
'Begin Registry setting
'"appname:=" = Desired name you create, variable or "string", preferred a "string"
'"section:=" = Desired name you create, variable or "string"
'"Key:=" = Desired name you create, variable or "string"
'Notes: Variables do not use quotes, strings use quotes
slogin = GetSetting(appname:="AppNameHere", section:="SectionNameHere", _
Key:="Login")
'End registry setting
Set rng1 = Application.Union(Range("a1:g1"), Range("H:iv"))
Set rng = Application.Intersect(Target, rng1)
If Not rng Is Nothing Then Exit Sub
V = Target.Offset(0, 12).Value
If Target.Offset(0, 12) = "" Then
With Range("H" & Target.Row)
.Value = Target.Address & ": first entry by " & slogin & " at " _
& Now()
.ColumnWidth = 60
.Interior.ColorIndex = 33
End With
Target.Offset(0, 12).Value = Target.Value
Application.EnableEvents = True
Exit Sub
End If
Target.Offset(0, 12).Value = Target.Value
With Range("H" & Target.Row)
.Value = Target.Address & " changed from " & V & " to " & Target.Value & " by " _
& slogin & " at " & Now()
.ColumnWidth = 60
.Interior.Color = vbYellow
End With
Application.EnableEvents = True
End Sub
Bookmarks