ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hit counter question (https://www.excelbanter.com/excel-programming/293361-hit-counter-question.html)

Bob Chapman

hit counter question
 
I need a hit counter on Excel 2003 which counts the number of times a
condition is met. This spreadsheet DDEs to RediPlus (trading software).
The DDE fields would be "last price" and "day high price". When last = day
high, I have it flash a green conditional format. What I would like to do
is to not only flash green but also count the number of times last = day
high. For example,

A1 = DDE link to "last price" of IBM (constantly changing)
B1 = DDE link to "day high price" of IBM (changes only when a new high is
made otherwise stays the same)

C1 = alert if they equal (IBM is making a new high) - flashes green via
condiitional format

I would like to put a hit counter in C1 that only increases when last = day
high

Seems simple, but I just can't get it to work

Thanks
Bob



Frank Kabel

hit counter question
 
Hi
have a look at
http://www.mcgimpsey.com/excel/accumulator.html
for creating an accumulator (you may use a different event, e.g.
worksheet_calculate instead of worksheet_change)

P.S.: also please don't multipost as this scatters your answers and
create additional effort for all who answer to your questions
--
Regards
Frank Kabel
Frankfurt, Germany

Bob Chapman wrote:
I need a hit counter on Excel 2003 which counts the number of times a
condition is met. This spreadsheet DDEs to RediPlus (trading
software). The DDE fields would be "last price" and "day high price".
When last = day high, I have it flash a green conditional format.
What I would like to do is to not only flash green but also count the
number of times last = day high. For example,

A1 = DDE link to "last price" of IBM (constantly changing)
B1 = DDE link to "day high price" of IBM (changes only when a new
high is made otherwise stays the same)

C1 = alert if they equal (IBM is making a new high) - flashes green
via condiitional format

I would like to put a hit counter in C1 that only increases when last
= day high

Seems simple, but I just can't get it to work

Thanks
Bob



Paul Robinson

hit counter question
 
Hi Bob,
Put this in the code module behind the sheet your values are on (Open
up the Visual Basic Editor, identify your workbook in the project
window and double click the appropriate sheet).
Note that format changes on a sheet do not trigger this event.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a1:b1")) Is Nothing Then
If Range("A1").Value = Range("B1").Value Then
Range("C1").Value = Range("C1").Value + 1
End If
End If
End Sub


regards
Paul
"Bob Chapman" wrote in message news:<7yw1c.25539$UU.21881@lakeread01...
I need a hit counter on Excel 2003 which counts the number of times a
condition is met. This spreadsheet DDEs to RediPlus (trading software).
The DDE fields would be "last price" and "day high price". When last = day
high, I have it flash a green conditional format. What I would like to do
is to not only flash green but also count the number of times last = day
high. For example,

A1 = DDE link to "last price" of IBM (constantly changing)
B1 = DDE link to "day high price" of IBM (changes only when a new high is
made otherwise stays the same)

C1 = alert if they equal (IBM is making a new high) - flashes green via
condiitional format

I would like to put a hit counter in C1 that only increases when last = day
high

Seems simple, but I just can't get it to work

Thanks
Bob


Paul Robinson

hit counter question
 
Hi
Occurs to me that this may not work with a DDE link, but might require
a manual change of the cell value.
You might need to add the relevant code after the link changes the
values in A1 and B1. Do you have access to that code so that it can be
edited?
Paul

(Paul Robinson) wrote in message . com...
Hi Bob,
Put this in the code module behind the sheet your values are on (Open
up the Visual Basic Editor, identify your workbook in the project
window and double click the appropriate sheet).
Note that format changes on a sheet do not trigger this event.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a1:b1")) Is Nothing Then
If Range("A1").Value = Range("B1").Value Then
Range("C1").Value = Range("C1").Value + 1
End If
End If
End Sub


regards
Paul
"Bob Chapman" wrote in message news:<7yw1c.25539$UU.21881@lakeread01...
I need a hit counter on Excel 2003 which counts the number of times a
condition is met. This spreadsheet DDEs to RediPlus (trading software).
The DDE fields would be "last price" and "day high price". When last = day
high, I have it flash a green conditional format. What I would like to do
is to not only flash green but also count the number of times last = day
high. For example,

A1 = DDE link to "last price" of IBM (constantly changing)
B1 = DDE link to "day high price" of IBM (changes only when a new high is
made otherwise stays the same)

C1 = alert if they equal (IBM is making a new high) - flashes green via
condiitional format

I would like to put a hit counter in C1 that only increases when last = day
high

Seems simple, but I just can't get it to work

Thanks
Bob



All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com