Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default is it possible to CLICK & insert date

is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default is it possible to CLICK & insert date

Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the column
number for your target column. It will insert the date just by entering the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default is it possible to CLICK & insert date

Mike
Change "Date" to "Now" to get the date and time. Format the cells
accordingly. HTH Otto
"Bob Phillips" wrote in message
...
Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the column
number for your target column. It will insert the date just by entering

the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default is it possible to CLICK & insert date

Unfortunately, this will also change the date of previously date-stamped
cells if the user navigates to them using the keyboard. I think the OP would
be better advised to use the DoubleClick event; that way there's no
confusion:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As _
Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 Then Target.Value = Now
End Sub

--

Vasant





"Bob Phillips" wrote in message
...
Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the column
number for your target column. It will insert the date just by entering

the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default is it possible to CLICK & insert date

Vasant,

You are probably right, but personally I do dislike the Double-Click event
<G.

You could always test for the target being empty.

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Unfortunately, this will also change the date of previously date-stamped
cells if the user navigates to them using the keyboard. I think the OP

would
be better advised to use the DoubleClick event; that way there's no
confusion:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As _
Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 Then Target.Value = Now
End Sub

--

Vasant





"Bob Phillips" wrote in message
...
Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the column
number for your target column. It will insert the date just by entering

the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default is it possible to CLICK & insert date

Hi Bob:

Matter of taste, I guess! I always try to discourage the use of the
SelectionChange as a substitute for the nonexistent Worksheet_Click event
because it makes it so much easier for the Law of Unintended (and possibly
Unnoticed) Consequences to rear its ugly head <g. People click all over a
worksheet without much conscious thought; double-clicking on a cell implies
true intent.

Also, I can just see an inexperienced user opening the sheet with the cursor
on A1 and scrolling down hundreds of rows with the SelectionChange event
firing and changing dates every 40 rows or so!

It would be nice if the SelectionChange event had a parameter to determine
whether the navigation was done via mouse or keyboard.

Regards,

Vasant.

"Bob Phillips" wrote in message
...
Vasant,

You are probably right, but personally I do dislike the Double-Click event
<G.

You could always test for the target being empty.

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Unfortunately, this will also change the date of previously date-stamped
cells if the user navigates to them using the keyboard. I think the OP

would
be better advised to use the DoubleClick event; that way there's no
confusion:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As _
Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 Then Target.Value = Now
End Sub

--

Vasant





"Bob Phillips" wrote in message
...
Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the

column
number for your target column. It will insert the date just by

entering
the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default is it possible to CLICK & insert date

Hi Vasant,

You hit the nail on the head there - the lack of the Worksheet_Click event
is the real problem. Must keep pressing MS for such.

Just a thought, if there were such an event, would SelectionChange then
just be triggered by keyboard, or would two events fire in the event of
clicking a cell?

Regards

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Hi Bob:

Matter of taste, I guess! I always try to discourage the use of the
SelectionChange as a substitute for the nonexistent Worksheet_Click event
because it makes it so much easier for the Law of Unintended (and possibly
Unnoticed) Consequences to rear its ugly head <g. People click all over a
worksheet without much conscious thought; double-clicking on a cell

implies
true intent.

Also, I can just see an inexperienced user opening the sheet with the

cursor
on A1 and scrolling down hundreds of rows with the SelectionChange event
firing and changing dates every 40 rows or so!

It would be nice if the SelectionChange event had a parameter to determine
whether the navigation was done via mouse or keyboard.

Regards,

Vasant.

"Bob Phillips" wrote in message
...
Vasant,

You are probably right, but personally I do dislike the Double-Click

event
<G.

You could always test for the target being empty.

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Unfortunately, this will also change the date of previously

date-stamped
cells if the user navigates to them using the keyboard. I think the OP

would
be better advised to use the DoubleClick event; that way there's no
confusion:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As _
Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 Then Target.Value = Now
End Sub

--

Vasant





"Bob Phillips" wrote in message
...
Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the

column
number for your target column. It will insert the date just by

entering
the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???











  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default is it possible to CLICK & insert date

Good question, Bob ... I can see problems with either implementation. That's
why I think having a single Selection_Change event with an option to
determine the method of navigation would give us the best of both worlds.
Then you could stop the event from firing (if you so wished) if the
navingation was via keyboard.

But I have a feeling we're going to be stuck with the current implelentation
for the foreseeable future ...

Regards,

Vasant.

"Bob Phillips" wrote in message
...
Hi Vasant,

You hit the nail on the head there - the lack of the Worksheet_Click event
is the real problem. Must keep pressing MS for such.

Just a thought, if there were such an event, would SelectionChange then
just be triggered by keyboard, or would two events fire in the event of
clicking a cell?

Regards

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Hi Bob:

Matter of taste, I guess! I always try to discourage the use of the
SelectionChange as a substitute for the nonexistent Worksheet_Click

event
because it makes it so much easier for the Law of Unintended (and

possibly
Unnoticed) Consequences to rear its ugly head <g. People click all over

a
worksheet without much conscious thought; double-clicking on a cell

implies
true intent.

Also, I can just see an inexperienced user opening the sheet with the

cursor
on A1 and scrolling down hundreds of rows with the SelectionChange event
firing and changing dates every 40 rows or so!

It would be nice if the SelectionChange event had a parameter to

determine
whether the navigation was done via mouse or keyboard.

Regards,

Vasant.

"Bob Phillips" wrote in message
...
Vasant,

You are probably right, but personally I do dislike the Double-Click

event
<G.

You could always test for the target being empty.

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Unfortunately, this will also change the date of previously

date-stamped
cells if the user navigates to them using the keyboard. I think the

OP
would
be better advised to use the DoubleClick event; that way there's no
confusion:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As _
Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 Then Target.Value = Now
End Sub

--

Vasant





"Bob Phillips" wrote in message
...
Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the

column
number for your target column. It will insert the date just by

entering
the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???













  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default is it possible to CLICK & insert date

I must admit, some sort of indication as to what fired the SeelectionChange
event , aka the CloseMode on a form QueryClose event, was not something that
occurred to me. And I think you are right about any changes.

Anyway, we must soldier on.

Regards

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Good question, Bob ... I can see problems with either implementation.

That's
why I think having a single Selection_Change event with an option to
determine the method of navigation would give us the best of both worlds.
Then you could stop the event from firing (if you so wished) if the
navingation was via keyboard.

But I have a feeling we're going to be stuck with the current

implelentation
for the foreseeable future ...

Regards,

Vasant.

"Bob Phillips" wrote in message
...
Hi Vasant,

You hit the nail on the head there - the lack of the Worksheet_Click

event
is the real problem. Must keep pressing MS for such.

Just a thought, if there were such an event, would SelectionChange then
just be triggered by keyboard, or would two events fire in the event of
clicking a cell?

Regards

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Hi Bob:

Matter of taste, I guess! I always try to discourage the use of the
SelectionChange as a substitute for the nonexistent Worksheet_Click

event
because it makes it so much easier for the Law of Unintended (and

possibly
Unnoticed) Consequences to rear its ugly head <g. People click all

over
a
worksheet without much conscious thought; double-clicking on a cell

implies
true intent.

Also, I can just see an inexperienced user opening the sheet with the

cursor
on A1 and scrolling down hundreds of rows with the SelectionChange

event
firing and changing dates every 40 rows or so!

It would be nice if the SelectionChange event had a parameter to

determine
whether the navigation was done via mouse or keyboard.

Regards,

Vasant.

"Bob Phillips" wrote in message
...
Vasant,

You are probably right, but personally I do dislike the Double-Click

event
<G.

You could always test for the target being empty.

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Unfortunately, this will also change the date of previously

date-stamped
cells if the user navigates to them using the keyboard. I think

the
OP
would
be better advised to use the DoubleClick event; that way there's

no
confusion:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As _
Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 Then Target.Value = Now
End Sub

--

Vasant





"Bob Phillips" wrote in

message
...
Mike,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Target.Value = Date
End If
End Sub

Insert this code in the appropriate worksheet module. Change the
column
number for your target column. It will insert the date just by
entering
the
cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MIKE" wrote in message
...
is it possible to
flag a column as a date column
and when you click a cell the date AND time is
inserted ???















  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default is it possible to CLICK & insert date

hi thanks for the code
but what can i add to it to NOT ONLY insert the Date
but the date and the time ?

thanks

MIKE KNOPFLER
COMPLEX PLASTICS LLC.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Right click mouse menu for insert does not work SueK Excel Discussion (Misc queries) 2 November 3rd 09 08:02 PM
how do I insert simple checkbox which can be checked by a click? mgreen74 Excel Discussion (Misc queries) 5 August 19th 09 04:31 PM
lost insert hyperlink option on right click gigi6d Excel Discussion (Misc queries) 2 March 15th 09 04:45 PM
double click insert date Slobodan Excel Worksheet Functions 1 February 16th 06 01:28 PM
Click on cell-calendar drops down-click on date-date fills cell. . George Setting up and Configuration of Excel 1 April 15th 05 08:22 AM


All times are GMT +1. The time now is 09:33 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"