Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default "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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default "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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default "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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default "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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a "date selector box" or "pull down box" in a cell GaryK Excel Worksheet Functions 2 September 30th 09 01:45 AM
Convert numbers to date: "586" to read "May 1986" CEckels Excel Worksheet Functions 5 May 14th 09 04:46 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"