ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding Time via mouse button (https://www.excelbanter.com/excel-programming/355771-adding-time-via-mouse-button.html)

Taz[_2_]

Adding Time via mouse button
 
I want to insert the TIME into a cell by the click of
the mouse button.

What do I neen to add to the beginning of
this formula

Sub Macro3()
'
' Keyboard Shortcut: Ctrl+x
'
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


--
Taz



Nigel

Adding Time via mouse button
 
put the code into a worksheet event - double click - you sure you want to do
this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
With Target
.FormulaR1C1 = "=NOW()"
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False
End Sub


--
Cheers
Nigel



"Taz" wrote in message
. uk...
I want to insert the TIME into a cell by the click of
the mouse button.

What do I neen to add to the beginning of
this formula

Sub Macro3()
'
' Keyboard Shortcut: Ctrl+x
'
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


--
Taz





Bob Phillips[_6_]

Adding Time via mouse button
 
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
With Target
.Value = Format(Time,"hh:mm:ss")
End With
Application.CutCopyMode = False
End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Nigel" wrote in message
...
put the code into a worksheet event - double click - you sure you want to

do
this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
With Target
.FormulaR1C1 = "=NOW()"
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False
End Sub


--
Cheers
Nigel



"Taz" wrote in message
. uk...
I want to insert the TIME into a cell by the click of
the mouse button.

What do I neen to add to the beginning of
this formula

Sub Macro3()
'
' Keyboard Shortcut: Ctrl+x
'
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


--
Taz







[email protected]

Adding Time via mouse button
 
You can do the same thing without code by using the shortcut key - CTRL
+ SHIFT + ;



All times are GMT +1. The time now is 12:19 AM.

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