Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 313
Default Auto entry on cell entry

into I have a column of cells I want to enter the current date everytime I
click in the cell. How do I do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Auto entry on cell entry

Excel doesn't have a click event that you can use. But it does have a
_beforedoubleclick and _beforerightclick.

This uses the beforerightclick event:

Option Explicit
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim myRng As Range
Set myRng = Me.Range("A:a") 'all of column A

Set Target = Target.Cells(1) 'one cell only

If Intersect(Target, myRng) Is Nothing Then
'do nothing
Else
Cancel = True 'don't show the rightclick popup menu
With Target
.NumberFormat = "mmmm dd, yyyy"
.Value = Date
End With
End If

End Sub

Rightclick on the worksheet tab that should have this behavior. Select view
code and paste this code into the newly opened code window (usually on the right
hand side).

Then back to excel to test it out.

Tony wrote:

into I have a column of cells I want to enter the current date everytime I
click in the cell. How do I do this?


--

Dave Peterson
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
Control Data Entry - push entry to next cell Ofelia Excel Discussion (Misc queries) 0 July 7th 08 04:19 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
How do I set up entry box to auto-alphabatize each entry in list? jhakers Excel Discussion (Misc queries) 0 February 14th 08 08:01 PM
Cell Entry That Locks Selected Cells From Any Data Entry. ron Excel Worksheet Functions 5 February 16th 07 09:52 PM
Auto Entry in a Cell englishtwit Excel Discussion (Misc queries) 4 May 17th 06 04:07 PM


All times are GMT +1. The time now is 11:09 PM.

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"