Dharris144
Board Regular
- Joined
- Jul 22, 2009
- Messages
- 97
Hello VB experts I could really use some help on recording changes to a a form control such as a check box.
I have the check boxes associated to cell ( one for each control different control)
I have this code to record changes to a "log" sheet. It is working fine but when I check a check box or tick an option control it does not log as a change.
Thanks in advance for any help you can provide.
Private Sub Workbook_Open()
Sheets("log").Visible = xlSheetVeryHidden
End Sub
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
On Error Resume Next
If Sheets("log").Visible = xlSheetVisible Then
Sheets("log").Visible = xlSheetVeryHidden
Else
Sheets("log").Visible = xlSheetVisible
End If
Target.Offset(1, 1).Select
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If ActiveSheet.Name <> "log" Then
Application.EnableEvents = False
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = ActiveSheet.Name & "-" & Target.Address(0, 0)
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(0, 1).Value = Target.Value
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(0, 2).Value = Environ("username")
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(0, 3).Value = Now
Sheets("log").Columns("A:D").AutoFit
Application.EnableEvents = True
End If
End Sub
I have the check boxes associated to cell ( one for each control different control)
I have this code to record changes to a "log" sheet. It is working fine but when I check a check box or tick an option control it does not log as a change.
Thanks in advance for any help you can provide.
Private Sub Workbook_Open()
Sheets("log").Visible = xlSheetVeryHidden
End Sub
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
On Error Resume Next
If Sheets("log").Visible = xlSheetVisible Then
Sheets("log").Visible = xlSheetVeryHidden
Else
Sheets("log").Visible = xlSheetVisible
End If
Target.Offset(1, 1).Select
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If ActiveSheet.Name <> "log" Then
Application.EnableEvents = False
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = ActiveSheet.Name & "-" & Target.Address(0, 0)
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(0, 1).Value = Target.Value
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(0, 2).Value = Environ("username")
Sheets("log").Range("A" & Rows.Count).End(xlUp).Offset(0, 3).Value = Now
Sheets("log").Columns("A:D").AutoFit
Application.EnableEvents = True
End If
End Sub