Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stamping current date when row data changes

Hi,

I am trying to get a cell in a particular column to change to the current
date, but only when any other data in that row is changed. Each cell in
that column then should have the last date that a cell was changed in that
row. We need to be able to perserve the current manual entry of dates last
updated in that column until the next change is made in that row.

I see some talk here about this Worksheet_Change sub, but not quite sure how
to change that to get the result I am looking for. I am sort of new to
writing VB in macros, so you'll have to forgive my lack of knowledge, hoping
someone can steer me to a good solution. Thanks

Craig


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Stamping current date when row data changes

Take a look at JE McGimpsey's site:
http://www.mcgimpsey.com/excel/timestamp.html

Craig Pohlman wrote:

Hi,

I am trying to get a cell in a particular column to change to the current
date, but only when any other data in that row is changed. Each cell in
that column then should have the last date that a cell was changed in that
row. We need to be able to perserve the current manual entry of dates last
updated in that column until the next change is made in that row.

I see some talk here about this Worksheet_Change sub, but not quite sure how
to change that to get the result I am looking for. I am sort of new to
writing VB in macros, so you'll have to forgive my lack of knowledge, hoping
someone can steer me to a good solution. Thanks

Craig


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Stamping current date when row data changes

This is worth a look too:
Function MyUserName() As String
MyUserName = Environ("UserName")
End Function

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("$A$1:$BB$4000")) Is Nothing Then
Application.EnableEvents = False
Application.ScreenUpdating = False
With Worksheets("Sheet2")
..Select
..Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Select
ActiveCell.Value = Target.Address
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Target.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Now()
ActiveCell.NumberFormat = "mm/dd/yy"
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = MyUserName()
Application.EnableEvents = True
Application.ScreenUpdating = True
End With
End If
End Sub

This is neat too:
Dim vOldVal 'Must be at top of module
Private Sub Worksheet_Change(ByVal Target As Range)
Dim bBold As Boolean
Dim rArea As Range
Dim rCell As Range
For Each rArea In Target.Areas
For Each rCell In rArea
'your individual cell code here
Next rCell
Next rArea


If Target.Cells.Count 1 Then Exit Sub
On Error Resume Next

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

If IsEmpty(vOldVal) Then vOldVal = "Empty Cell"
bBold = Target.HasFormula
With Sheet1
.Unprotect Password:="Secret"
If .Range("A1") = vbNullString Then
.Range("A1:E1") = Array("CELL CHANGED", "OLD VALUE", _
"NEW VALUE", "TIME OF CHANGE", "DATE OF CHANGE")
End If


With .Cells(.Rows.Count, 1).End(xlUp)(2, 1)
.Value = Target.Address
.Offset(0, 1) = vOldVal
With .Offset(0, 2)
If bBold = True Then
.ClearComments
.AddComment.Text Text:= _
"OzGrid.com:" & Chr(10) & "" & Chr(10) & _
"Bold values are the results of formulas"
End If
.Value = Target
.Font.Bold = bBold
End With

.Offset(0, 3) = Time
.Offset(0, 4) = Date
End With
.Cells.Columns.AutoFit
'.Protect Password:="Secret"
End With
vOldVal = vbNullString

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

On Error GoTo 0
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
vOldVal = Target
End Sub


Regards,
Ryan---

--
RyGuy


"Dave Peterson" wrote:

Take a look at JE McGimpsey's site:
http://www.mcgimpsey.com/excel/timestamp.html

Craig Pohlman wrote:

Hi,

I am trying to get a cell in a particular column to change to the current
date, but only when any other data in that row is changed. Each cell in
that column then should have the last date that a cell was changed in that
row. We need to be able to perserve the current manual entry of dates last
updated in that column until the next change is made in that row.

I see some talk here about this Worksheet_Change sub, but not quite sure how
to change that to get the result I am looking for. I am sort of new to
writing VB in macros, so you'll have to forgive my lack of knowledge, hoping
someone can steer me to a good solution. Thanks

Craig


--

Dave Peterson

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
Automatic date stamping PK Excel Discussion (Misc queries) 16 December 13th 09 10:04 PM
Date stamping a cell change Mustang Excel Discussion (Misc queries) 3 July 15th 09 11:17 PM
Date and time stamping with a (macro) button ArcticWolf Excel Worksheet Functions 4 July 10th 08 12:26 PM
Automatic Date Stamping Risky Dave Excel Programming 1 April 4th 08 02:32 PM
Date stamping based on cell value Bob Excel Programming 6 February 1st 07 03:59 PM


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