Hi,
I have used this coding before but for a maximum of two column ranges. In this case I have 5 columns which we want to be able to be 'signed' by double-clicking and auto entering the user ID time stamp. Can anyone help fix this coding to allow for this?
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim myrange As Range
Dim myCalc As XlCalculationState
Dim ws As Worksheet
Dim r As Long
Application.ScreenUpdating = False
Set myrange = ActiveSheet.Range("Signature")
If Target.Cells.Count > 1 Then
Exit Sub
End If
If Intersect(Target, myrange) Is Nothing Then
Exit Sub
End If
If ActiveCell > 0 Then
MsgBox "Already Actioned", vbInformation, "Error"
Cancel = True
Exit Sub
End If
If MsgBox("Confirm Submission / Authorisation?", vbYesNo + vbQuestion, "Submit / Authorise") = vbNo Then
Cancel = True
Exit Sub
End If
myCalc = Application.Calculation
Application.Calculation = xlCalculationManual
r = Target.Row
If ActiveSheet.Cells(Target.Row, 17) <= 0 Then
ActiveSheet.Cells(r, 17).Value = Environ("Username") & " " & Format(Now, "hh:mm dd-mmm-yy")
ElseIf ActiveSheet.Cells(Target.Row, 17) > 0 Then
ActiveSheet.Cells(r, 18).Value = Environ("Username") & " " & Format(Now, "hh:mm dd-mmm-yy")
End If
Cancel = True
Application.Calculation = myCalc
Application.ScreenUpdating = True
End Sub
Thank you!
Bookmarks