Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Date and time entry on button click

Here's an easy one:

For the spreadsheet I am developing I want to track changes on a separate
sheet. On the main sheet I have added in a button that will activate the
changes sheet but how do I make it so the current system date and time get
populated in columns A and B in the next empty row?

Thanks in advance for your help.
Neal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Date and time entry on button click


bearsfan wrote:
Here's an easy one:

For the spreadsheet I am developing I want to track changes on a separate
sheet. On the main sheet I have added in a button that will activate the
changes sheet but how do I make it so the current system date and time get
populated in columns A and B in the next empty row?

Thanks in advance for your help.
Neal



First

Range("A5").Select

Make the cell equal to the formula <=Today()

Then

Range("A5").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

You copy todays date and paste it as a value so it is static.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Date and time entry on button click

Sub record_it()
Dim r As Range
Dim free_row As Long
Worksheets("Sheet2").Activate
Set r = ActiveSheet.UsedRange
free_row = r.Rows.Count + r.Row
Cells(free_row, 1) = Date
Cells(free_row, 2) = Time
End Sub

This code will not write in open areas in the middle of your used range.
--
Gary''s Student


"bearsfan" wrote:

Here's an easy one:

For the spreadsheet I am developing I want to track changes on a separate
sheet. On the main sheet I have added in a button that will activate the
changes sheet but how do I make it so the current system date and time get
populated in columns A and B in the next empty row?

Thanks in advance for your help.
Neal

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Date and time entry on button click

Thanks for your help Gary's Student & Smarty Pants! Much appreciated.

"Gary''s Student" wrote:

Sub record_it()
Dim r As Range
Dim free_row As Long
Worksheets("Sheet2").Activate
Set r = ActiveSheet.UsedRange
free_row = r.Rows.Count + r.Row
Cells(free_row, 1) = Date
Cells(free_row, 2) = Time
End Sub

This code will not write in open areas in the middle of your used range.
--
Gary''s Student


"bearsfan" wrote:

Here's an easy one:

For the spreadsheet I am developing I want to track changes on a separate
sheet. On the main sheet I have added in a button that will activate the
changes sheet but how do I make it so the current system date and time get
populated in columns A and B in the next empty row?

Thanks in advance for your help.
Neal

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
Time entry auto changes to date and then time ? Carol @ Prison[_2_] Excel Worksheet Functions 1 November 25th 09 10:01 PM
Time and date each entry MAS Excel Programming 4 February 25th 06 01:22 AM
Date and time entry Hans Knudsen[_2_] Excel Programming 1 November 27th 05 05:42 AM
Auto Date/Time when click on cell MAGICofSeth Excel Programming 3 May 17th 04 02:36 AM
Double-click date entry RJH Excel Programming 2 January 30th 04 04:41 PM


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