![]() |
Double-click date entry
I can get the code below to work in any cell I double-click in. I would
like to limit the double-click event to column 1 only. The rest of the sheet should function as normal. How do I limit the date entry to to a single column and then have the active cell jump automatically one column to the left? Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) ActiveCell.Value = Format(Now(), "mm-dd-yyyy") End Sub Thanks for your help! Bob Howard |
Double-click date entry
Bob,
There are no columns left of column 1 :) This example selects 1 column to the right: Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) If Target.Column = 1 Then Target.Value = Format(Now(), "mm-dd-yyyy") Target.Offset(0, 1).Select End If End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "RJH" wrote in message ... I can get the code below to work in any cell I double-click in. I would like to limit the double-click event to column 1 only. The rest of the sheet should function as normal. How do I limit the date entry to to a single column and then have the active cell jump automatically one column to the left? Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) ActiveCell.Value = Format(Now(), "mm-dd-yyyy") End Sub Thanks for your help! Bob Howard |
Double-click date entry
Rob,
My mistake, to the right is where I was going. Thanks! It works great! Bob Howard "Rob van Gelder" wrote in message ... Bob, There are no columns left of column 1 :) This example selects 1 column to the right: Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) If Target.Column = 1 Then Target.Value = Format(Now(), "mm-dd-yyyy") Target.Offset(0, 1).Select End If End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "RJH" wrote in message ... I can get the code below to work in any cell I double-click in. I would like to limit the double-click event to column 1 only. The rest of the sheet should function as normal. How do I limit the date entry to to a single column and then have the active cell jump automatically one column to the left? Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) ActiveCell.Value = Format(Now(), "mm-dd-yyyy") End Sub Thanks for your help! Bob Howard |
All times are GMT +1. The time now is 10:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com