Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default record cell activity

How can I record data changes in a cell from a formulas?

Tracker doesn't do this function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default record cell activity

Just a single or a few cells?

Excel won't help you by telling what cells changed values. You'll have to keep
track of them yourself--maybe in a hidden worksheet???

Then you could use the worksheet_calculate (or Workbook_SheetCalculate) event to
look at each of those cells. If the value changed from the previous value, then
write it to that hidden worksheet.

This checks a single cell (A1) of a worksheet. And the code goes in the
worksheet module for that sheet.

Option Explicit
Private Sub Worksheet_Calculate()
Dim LastCell As Range
With Worksheets("hidden")
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
End With

If Me.Range("A1").Value2 = LastCell.Value2 Then
'no change
Else
Application.EnableEvents = False
LastCell.Offset(1, 0).Value2 = Me.Range("a1").Value2
Application.EnableEvents = True
End If
End Sub




sausages wrote:

How can I record data changes in a cell from a formulas?

Tracker doesn't do this function


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default record cell activity

There's a bug in that program.

Change this line:
With Worksheets("hidden")
to
With me.parent.Worksheets("hidden")

If the worksheet recalculates when its workbook is not active, then the original
code would blow up!


Dave Peterson wrote:

Just a single or a few cells?

Excel won't help you by telling what cells changed values. You'll have to keep
track of them yourself--maybe in a hidden worksheet???

Then you could use the worksheet_calculate (or Workbook_SheetCalculate) event to
look at each of those cells. If the value changed from the previous value, then
write it to that hidden worksheet.

This checks a single cell (A1) of a worksheet. And the code goes in the
worksheet module for that sheet.

Option Explicit
Private Sub Worksheet_Calculate()
Dim LastCell As Range
With Worksheets("hidden")
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
End With

If Me.Range("A1").Value2 = LastCell.Value2 Then
'no change
Else
Application.EnableEvents = False
LastCell.Offset(1, 0).Value2 = Me.Range("a1").Value2
Application.EnableEvents = True
End If
End Sub

sausages wrote:

How can I record data changes in a cell from a formulas?

Tracker doesn't do this function


--

Dave Peterson


--

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
activity Don Guillett[_2_] Excel Worksheet Functions 1 August 5th 11 08:14 PM
Activity Don Guillett[_2_] Excel Worksheet Functions 3 August 4th 11 04:36 PM
Alert if the travel activity is after the work activity Go Bucks!!! Excel Worksheet Functions 3 September 11th 09 05:44 PM
activity duration -jawad Setting up and Configuration of Excel 1 August 27th 07 01:18 AM
An 'event' of zero activity? don bowyer Excel Programming 5 September 27th 04 09:51 PM


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