2 different functions on Double Click

S

Sige

Hi There,

On double click I would like to insert a date in certain ranges ...
but with a double click in another range I would like to write an "a".

Underneath code gets confused ...

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
' If Target.Column = 1 Then
If Not Intersect(Target, Range("d3:d65000", "k3:m65000")) Is
Nothing Then
Target.Value = Format(Now(), "mm-dd")
Target.Offset(0, 1).Select
End If

If Not Intersect(Target, Range("f3:h65000")) Is Nothing Then
Cancel = True 'Prevent going into Edit Mode
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
End Sub

How being able to combine both functionalities?
BRG Sige
 
B

Bob Phillips

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
' If Target.Column = 1 Then
If Not Intersect(Target, Range("d3:d65000, k3:m65000")) Is Nothing Then
Target.Value = Format(Now(), "mm-dd")
Target.Offset(0, 1).Select
ElseIf Not Intersect(Target, Range("f3:h65000")) Is Nothing Then
Cancel = True 'Prevent going into Edit Mode
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top