Changing Value

A

Alectrical

Hi
I have a cell that has a value that changes every second, every time this
value changes I need to update values in three other cells, ie A1 to A3 by
adding one to there existing values.
When I try Worksheet Calculate or Change I sometimes get multiple updates
instead of the single event I require.
Any Ideas

Thanks Alec
 
M

Mike H

What causes the value of the cell to change every second? perhaps you can
simply increment the cells from there.

or perhaps try this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$4" Then
Set myrange = Range("A1:A3")
For Each c In myrange
c.Value = c.Value + 1
Next
End If
End Sub

This assumes you update a second cell is A4

Mike
 
H

Halim

Alec,

I hope this helpfull:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Address = "$B$1" Then
For Each rng In Range("A1:A3")
If IsNumeric(rng) Then rng = rng + 1
Next rng
End If
End Sub

change "$B$1" to suit your range to fire worksheet_change
 
A

Alectrical

Thanks Halim


Halim said:
Alec,

I hope this helpfull:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Address = "$B$1" Then
For Each rng In Range("A1:A3")
If IsNumeric(rng) Then rng = rng + 1
Next rng
End If
End Sub

change "$B$1" to suit your range to fire worksheet_change
 
A

Alectrical

Thanks Mike

Mike H said:
What causes the value of the cell to change every second? perhaps you can
simply increment the cells from there.

or perhaps try this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$4" Then
Set myrange = Range("A1:A3")
For Each c In myrange
c.Value = c.Value + 1
Next
End If
End Sub

This assumes you update a second cell is A4

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top