ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Before DoubleClick (https://www.excelbanter.com/excel-programming/280762-before-doubleclick.html)

John Pierce

Before DoubleClick
 
In this same vein, I have a macro that enters today's date in the
selected,
or target, cell by double-clicking. (It then activates the next cell
down,
which I found was necessary to complete and exit the procedure.) The
code
is below:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Target.Value = Now()
Target.NumberFormat = "mmm d"
ActiveCell.Offset(1, 0).Select
End Sub

What I would like to do is limit the operation of this procedure to a
particular column, column F, so that if someone happened to
double-click in, say, cell D5 it would not replace what is there with
today's date.

Ron de Bruin

Before DoubleClick
 
Try this John

If Target.Column = 6 Then
' code
End If


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"John Pierce" wrote in message om...
In this same vein, I have a macro that enters today's date in the
selected,
or target, cell by double-clicking. (It then activates the next cell
down,
which I found was necessary to complete and exit the procedure.) The
code
is below:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Target.Value = Now()
Target.NumberFormat = "mmm d"
ActiveCell.Offset(1, 0).Select
End Sub

What I would like to do is limit the operation of this procedure to a
particular column, column F, so that if someone happened to
double-click in, say, cell D5 it would not replace what is there with
today's date.





All times are GMT +1. The time now is 07:34 AM.

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