Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Excel - Get Date"
Is there a way to have a cell so that when it is clicked on or somethin
it automaticaly enters the date. Probs get it off the computer cloc or something -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Excel - Get Date"
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("A1")) Is Nothing Then With Target .Value = Format(Date, "dd mmm yyyy") End With End If ws_exit: Application.EnableEvents = True End Sub This is worksheet code, so to enter it, right-click on the sheet tab, select View Code from the menu, and paste the code. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Fraggs " wrote in message ... Is there a way to have a cell so that when it is clicked on or something it automaticaly enters the date. Probs get it off the computer clock or something? --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Excel - Get Date"
search this NG for time stamp
One way is to use the sheets selection change event ( right click the sheet tab to get to its code page) The following will place a time stamp if cell C2 is selected... Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim sText As String If Target.Address = "$C$2" Then sText = Format$(Date, "dd-mmm-yy") sText = sText & " " & Format$(Now, "HH:MM") Target.Value = sText End If End Sub Patrick Molloy Microsft Excel MVP -----Original Message----- Is there a way to have a cell so that when it is clicked on or something it automaticaly enters the date. Probs get it off the computer clock or something? --- Message posted from http://www.ExcelForum.com/ . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Excel - Get Date"
If you want the current data in a cell, simply type =TODAY() in it. BUT: As this is a formula, the data will automatically change whenever the workbook is recalculated
If you want the data inserted only when the user enters that particular cell Use this code: it must be in the Sheet Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range If Not Application.Intersect(Target, Range("A5")) Is Nothing The Range("A5") = Dat End I End Su NOTE: just usiing Date ensures that the current date is shown in the date format found in Regional Settings on your PC. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Excel - Get Date"
You will need to go to the Sheet object and choose the event
SheetSelectionChange In that event (macro) insert this code: If target.address = range("A1").address then range("A1") = date Where A1 is the cell, if clicked on, you want the current date/time. Format that cell to display date, time or both. TH On 4/22/04 2:00, in article , "Fraggs " wrote: Is there a way to have a cell so that when it is clicked on or something it automaticaly enters the date. Probs get it off the computer clock or something? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
creating a "date selector box" or "pull down box" in a cell | Excel Worksheet Functions | |||
Convert numbers to date: "586" to read "May 1986" | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |