ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2 different functions on Double Click (https://www.excelbanter.com/excel-programming/340576-2-different-functions-double-click.html)

SIGE

2 different functions on Double Click
 
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


Bob Phillips[_6_]

2 different functions on Double Click
 
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


--
HTH

Bob Phillips

"Sige" wrote in message
oups.com...
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




SIGE

2 different functions on Double Click
 
Thx Bob,
Wonderful as usual!

:o) Sige



All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com