Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i make a cell date sensitive to execute a formula or input. | Excel Discussion (Misc queries) | |||
How do I make a cell date specific to input a value on a specific. | Excel Discussion (Misc queries) | |||
Running Data Table using an input that triggers DDE linked data | Excel Discussion (Misc queries) | |||
Addition to Turn cell red if today is greater or equal to date in cell | New Users to Excel | |||
GET.CELL | Excel Worksheet Functions |