Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Run a macro in active cell only. Want to place current date/time.

Would like to make a Gate sign in sheet with a macro named ("GateIN") that
will return the current date/time in the active cell only. When the same
macro is run in an other cell I'd like the later current time to be entered
but leave the previous cell un-touched.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Run a macro in active cell only. Want to place current date/time.


time clock watcher,

PLEASE TEST THIS FIRST IN A COPY OF YOUR WORKBOOK (ALWAYS MAKE A BACKUP
COPY BEFORE TRYING NEW CODE, YOU NEVER KNOW WHAT YOU MIGHT LOSE).

Adding the Macro
1. Copy the below macro, by highlighting the macro code and pressing
the keys CTRL+C
2. Open your workbook
3. Press the keys ALT+F11 to open the Visual Basic Editor
4. Press the keys ALT+I to activate the Insert menu
5. Press M to insert a Standard Module
6. Paste the code by pressing the keys CTRL+V
7. Press the keys ALT+Q to exit the Editor, and return to Excel.


Code:
--------------------


Sub GateIN()
With ActiveCell
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm AM/PM"
End With
End Sub


--------------------



Then run the "GateIN" macro.


Have a great day,
Stan


--
stanleydgromjr
------------------------------------------------------------------------
stanleydgromjr's Profile: http://www.thecodecage.com/forumz/member.php?userid=503
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=117185

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Run a macro in active cell only. Want to place current date/time.

Sub GateIN()
ActiveCell.value = Now
End sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"time clock watcher" wrote:

Would like to make a Gate sign in sheet with a macro named ("GateIN") that
will return the current date/time in the active cell only. When the same
macro is run in an other cell I'd like the later current time to be entered
but leave the previous cell un-touched.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Run a macro in active cell only. Want to place current date/time.


You probably want this

Code:
--------------------
Sub GateIN()
If ActiveCell = "" Then
ActiveCell.Value = Now
Else
ActiveCell.Offset(0, 1).Value = Now
End If
End Sub

--------------------
Luke M;421239 Wrote:
Sub GateIN()
ActiveCell.value = Now
End sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"time clock watcher" wrote:

Would like to make a Gate sign in sheet with a macro named ("GateIN")

that
will return the current date/time in the active cell only. When the

same
macro is run in an other cell I'd like the later current time to be

entered
but leave the previous cell un-touched.



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=117185

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
Cell value determined by the current time and date jschae Excel Worksheet Functions 4 June 12th 09 01:45 PM
Place a Dynamic Date + a Certain Time in a Cell Sean Excel Worksheet Functions 3 January 6th 07 05:37 PM
How to add todays date (static) to the current active cell using m JimmyJam75 Excel Discussion (Misc queries) 5 September 6th 06 11:23 AM
Current date and time when different cell = X Workaholic Excel Worksheet Functions 3 August 13th 06 12:49 AM
current Date and time in cell Alex01 Excel Discussion (Misc queries) 3 February 24th 06 09:22 PM


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