View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
R Tanner R Tanner is offline
external usenet poster
 
Posts: 87
Default Run Procedure when The Value of A Cell Changes

Okay I actually Did something different, which I have listed below...

The problem is I showed it to our trade analysts and they liked it.
lol ( wasn't expected). So to modify, there are some changes I would
need to make to this.

To give you a thorough idea, I have a series of indicators that update
a table of mine. I need to record each indicator's table of data
(which will update when the value of that cell changes) in a separate
workbook. It would be extremely inefficient to have 19 different
workbooks open recording data at the same time. So, would I be able
to record data to a closed excel workbook? Or maybe I can have 1
workbook open and have the data written to different csv files which I
could then import into different workbooks with a small macro...

What do you think?



Private Sub Worksheet_Calculate()
Dim R1 As Range
Dim I As Integer
Dim CR1 As Range
Dim R2 As Range
Dim CR2 As Range
Dim I2 As Integer
Dim R3 As Range
Dim CR3 As Range
Dim I3 As Integer
Dim R4 As Range
Dim CR4 As Range
Dim I4 As Integer
Dim R5 As Range
Dim CR5 As Range
Dim I5 As Integer
Dim R6 As Range
Dim CR6 As Range
Dim I6 As Integer



Set R1 = Range("C4")
Set CR1 = Range("J4")
Set R2 = Range("D4")
Set CR2 = Range("L4")
Set R3 = Range("C5")
Set CR3 = Range("O4")
Set R4 = Range("D5")
Set CR4 = Range("Q4")
Set R5 = Range("C6")
Set CR5 = Range("T4")
Set R6 = Range("D6")
Set CR6 = Range("V4")



If R1.Value < CR1.End(xlDown).Value Then
I = Range(CR1, CR1.End(xlDown)).Rows.Count
CR1.Offset(I, 0).Value = R1.Value
CR1.Offset(I, -1) = Time
End If
If R2.Value < CR2.End(xlDown).Value Then
I2 = Range(CR2, CR2.End(xlDown)).Rows.Count
CR2.Offset(I2, 0).Value = R2.Value
CR2.Offset(I2, -1) = Time
End If
If R3.Value < CR3.End(xlDown).Value Then
I3 = Range(CR3, CR3.End(xlDown)).Rows.Count
CR3.Offset(I3, 0).Value = R3.Value
CR3.Offset(I3, -1) = Time
End If
If R4.Value < CR4.End(xlDown).Value Then
I4 = Range(CR4, CR4.End(xlDown)).Rows.Count
CR4.Offset(I4, 0).Value = R4.Value
CR4.Offset(I4, -1) = Time
End If
If R5.Value < CR5.End(xlDown).Value Then
I5 = Range(CR5, CR5.End(xlDown)).Rows.Count
CR5.Offset(I5, 0).Value = R5.Value
CR5.Offset(I5, -1) = Time
End If
If R6.Value < CR6.End(xlDown).Value Then
I6 = Range(CR6, CR6.End(xlDown)).Rows.Count
CR6.Offset(I6, 0).Value = R6.Value
CR6.Offset(I6, -1) = Time
End If
End Sub