Double-click entry
Rob gave me some of the code below. I've modified it to include 2 columns
instead of 1 and a message box. It works just fine but I'm sure there's a
better way to write it then to double up the code. I've tried a few things
with no luck. How would I trim this down?
Thanks!
Bob Howard
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Column = 1 Then
If Target.Cells 0 Then GoTo Line1 Else
Target.Value = Format(Now(), "mm-dd-yyyy")
Target.Offset(0, 1).Select
Exit Sub
Line1:
MsgBox "This cell contains a date, choose another cell", vbCritical
Target.Offset(0, 1).Select
End If
If Target.Column = 11 Then
If Target.Cells 0 Then GoTo Line2 Else
Target.Value = Format(Now(), "mm-dd-yyyy")
Target.Offset(0, 1).Select
Exit Sub
Line2:
MsgBox "This cell contains a date, choose another cell", vbCritical
Target.Offset(0, 1).Select
End If
End Sub
|