Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
GaryByrd
 
Posts: n/a
Default Input Date when data is entered into another cell

I am trying to use Excel sorta like a database. When I enter data into a cell
such as B1 I want A1 to stamp the date and time.
  #2   Report Post  
Otto Moehrbach
 
Posts: n/a
Default

Gary
You'll need an event macro to do that. Something like:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Or Target = "" Then Exit Sub
If Target.Column = 2 Then Target.Offset(, -1) = Now
End Sub

Watch out for line wrap in this message. Expand this message to see the
code properly. Right-click on the sheet tab, select View Code, and paste
this macro in that module. HTH Otto
"GaryByrd" wrote in message
...
I am trying to use Excel sorta like a database. When I enter data into a
cell
such as B1 I want A1 to stamp the date and time.



  #3   Report Post  
Gord Dibben
 
Posts: n/a
Default

Gary

Copy/paste the following into a worksheet module. Right-click on the sheet
tab and "View Code". Paste in there. Format Column A to Time.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in Col B
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then 'can be modified, see below
n = Target.row
If Excel.Range("B" & n).Value < "" Then
Excel.Range("A" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub

As written, operates on all of column B.

'For one cell use
'If Target.Address = "$B$1" Then
'''
'For a range use
'If Not Application.Intersect(Range("B1:B20"), Target) Is Nothing Then


Gord Dibben Excel MVP

On Mon, 31 Jan 2005 14:57:03 -0800, "GaryByrd"
wrote:

I am trying to use Excel sorta like a database. When I enter data into a cell
such as B1 I want A1 to stamp the date and time.


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
how do i make a cell date sensitive to execute a formula or input. ebuzz13 Excel Discussion (Misc queries) 2 January 20th 05 09:33 PM
How do I make a cell date specific to input a value on a specific. ebuzz13 Excel Discussion (Misc queries) 1 January 18th 05 06:53 PM
Running Data Table using an input that triggers DDE linked data [email protected] Excel Discussion (Misc queries) 1 December 16th 04 12:56 PM
Addition to Turn cell red if today is greater or equal to date in cell Rich New Users to Excel 2 December 9th 04 03:06 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 08:16 PM


All times are GMT +1. The time now is 06:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"