Record Change in Value from a live feed Cell

jk64

New Member
Joined
Jun 9, 2011
Messages
11
I need VBA cod thatrecords the number of times a cell in a worksheet has a value change.

For example if cell J5 contains the live feed, if thatl value is changed to this would be recorded as 1 in the cell using the recording function. If that Cell value is then changed to 11, the cell change would be recorded as 2.

I'm really new to all this code stuff so help would be very much aprreciated.

I've tried using this and lsight variations, but none have worked:
Code:
Private Sub Worksheet_Calculate()
Static OldVal As Variant
With Range("B3")
    Application.EnableEvents = False
    If .Value <> OldVal Then
        .Offset(, 4).Value = Target.Offset(, 4).Value + 1
    End If
    Application.EnableEvents = True
End With
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
If your feed triggers a calculate event then it would be

Code:
Private Sub Worksheet_Calculate()
Static OldVal As Variant
With Range("B3")
    If .Value <> OldVal Then
        .Offset(, 4).Value = .Offset(, 4).Value + 1
        OldVal = .Value
    End If
End With
 
Upvote 0
Hey Peter,

Thanks for your time.

I tired the code you posted and it didn't work. Maybe the live feed isnt a calculation event.

What i'm feeding is in bloomberg quotes. The cell function starts with =BDP(.....) where the dots are just locating the quotes in Blmbrg.

Any other suggestions?
 
Upvote 0
Maybe it will trigger a change event. change B3 to the cell that receives the feed

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Static OldVal As Variant
If Target.Address(False, False) = "B3" Then
    With Target
        If .Value <> OldVal Then
            .Offset(, 4).Value = .Offset(, 4).Value + 1
            OldVal = .Value
        End If
    End With
End If
End Sub
 
Upvote 0
Sorry Peter, but that didn't work either.

A couple of thoughts:
- Maybe it doent recognize a change becasue the actual contents of the cell arn't changing. The cell in the formula bar always reads "=BDP(...)", but the value projected in the cell is an interger changes in real time.
-Should I input in the place of B3 the actualy contents of the cell, i.e. the "=BDP(...)" stuff?

Suggestions?
 
Upvote 0
Try entering this formula in a remote cell like Z1

=B3

then try the code that I posted in post #2.
 
Upvote 0
Tried it and still nothing.
I'm assuming that you wanted me to put Z1 into the code. If that wasn't the case let me know.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,123
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top