Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help with Macro or VBA script - Insert current Time/Date for different records

Hello,

I'm trying to work on a spreed sheet for tracking vendor calls and what
have you. I would like to make it easy for our workers to insert the
current date and time by means of a mouse click. Currently I have used
validation to give them dropdown lists for varying cell data and would
like something kinda like that for the date/time issue. I know of the
=NOW() function but the issue i have with, when wrapped with validation
at least) is that it needs to be recalculated which means they have to
click the drop down box, select the time and then reclick to post the
current date/time.

I'm sure I will need to use a Macro or VBA but I'm pretty green on both
these topics and would like some input on how I might accomplish said
task. It looks as if VBA is more advanced than a regular macro so I
assume VBA is the way to go.


Thanks ahead of time for all your input.

Mattchewie

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Help with Macro or VBA script - Insert current Time/Date for diffe

You could create a button - either a CommandButton on your sheet or a custom
toolbar button, and set it to run the following code:

Public Sub Button1.Click
ActiveCell.Value = Now()
ActiveCell.NumberFormat = "mm/dd/yy hh:mm"
End Sub

Then NumberFormat part is to make sure the time stamp shows as a date/time
and not as a numeric value, which would look strange - you could adjust the
format there it if you prefer it to be different.

P.S. in the current Excel world macros and VBA are really the same: the
macro recorder simply creates VBA code for you, and thus is easier for users
who do not know how to write code, but you can always edit the code or create
your own. A good way to get started is to record some macros as you do
various things and look at the resulting code - you can learn a lot this way.
But as you learn more VBA you will learn how you can write code that is more
efficient and more adaptable to different situations than you will get with
the macro recorder.

" wrote:

Hello,

I'm trying to work on a spreed sheet for tracking vendor calls and what
have you. I would like to make it easy for our workers to insert the
current date and time by means of a mouse click. Currently I have used
validation to give them dropdown lists for varying cell data and would
like something kinda like that for the date/time issue. I know of the
=NOW() function but the issue i have with, when wrapped with validation
at least) is that it needs to be recalculated which means they have to
click the drop down box, select the time and then reclick to post the
current date/time.

I'm sure I will need to use a Macro or VBA but I'm pretty green on both
these topics and would like some input on how I might accomplish said
task. It looks as if VBA is more advanced than a regular macro so I
assume VBA is the way to go.


Thanks ahead of time for all your input.

Mattchewie


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Help with Macro or VBA script - Insert current Time/Date for different records

No nacro needed Mattchewie
CTRL+; inserts the current date
CTRL+SHIFT+; inserts the current time

With kind regards,
Ton Teuns

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help with Macro or VBA script - Insert current Time/Date for diffe

K Dales,

This is pretty much what I was looking for !! thank you!

One thing I did notice is that the timestamp is only placed in when the
cell is active and not in edit mode.

I was wondering if there is a code option to were the user could be
editing the cell and then be able to click this timestamp button to
give the date. I'm trying to educate them in the Ctrl+; and the
Ctrl+shift+; but untill they fully understand I would like for this
button to the so called panic button

let me know if I need to elborate more on that idea (5:24am right now
and not thinking straight lol)



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Help with Macro or VBA script - Insert current Time/Date for d

I think I understand; the problem is that I don't know how to get a macro to
run while in edit mode. Edit mode is in effect like a procedure itself that
"runs" and can't be interrupted until it is complete (i.e. the user finishes
entering the changes). There may be some ways to do this that I am not aware
of; you may want to search to see if anyone has asked a question like that
before (perhaps search on Edit Mode).

" wrote:

K Dales,

This is pretty much what I was looking for !! thank you!

One thing I did notice is that the timestamp is only placed in when the
cell is active and not in edit mode.

I was wondering if there is a code option to were the user could be
editing the cell and then be able to click this timestamp button to
give the date. I'm trying to educate them in the Ctrl+; and the
Ctrl+shift+; but untill they fully understand I would like for this
button to the so called panic button

let me know if I need to elborate more on that idea (5:24am right now
and not thinking straight lol)


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
Run a macro in active cell only. Want to place current date/time. time clock watcher Excel Worksheet Functions 3 July 20th 09 07:46 AM
VB script for Current time [email protected] Excel Worksheet Functions 2 June 1st 09 08:55 PM
Formatting a row to insert current date and time on demand MorseCode Excel Worksheet Functions 1 May 17th 08 12:59 AM
Any quick key to insert current Date and Time? Philip Excel Discussion (Misc queries) 2 January 12th 06 04:16 PM
how do I insert the current time (static) and date in a cell? DF Excel Discussion (Misc queries) 5 October 28th 05 05:54 PM


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