0

Kindly help me on solving the following requirement.

In my sheet , say in cell A1 the value of the cell needs to be incremented by 1 till it equals the value of B1. Cell B1 value would be 10.

When Incremental value of cell A1 reaches 10, the incremental loop needs to restart from 1 again. The value of cell A1 should increment every minute.

I have tried the this with the following formula. I have a macro to refresh excel by 1 minute. =IF((a1+1)<=b1,(a1+1),1) Works fine but returns the circular reference error. So I was wondering whether VBA can do this for me in background

Regards Dilan

Harun24hr
  • 30,391
  • 4
  • 21
  • 36
Dilan
  • 5
  • 1
  • Post your refresh code here. Need to insert code inside time. – Harun24hr Aug 27 '20 at 09:43
  • Find something useful here : https://stackoverflow.com/questions/2319683/vba-macro-on-timer-style-to-run-code-every-set-number-of-seconds-i-e-120-secon – Macronaute Aug 27 '20 at 09:53

1 Answers1

1

You need VBA to do that. You need to check value of A1 and compare it with B1 then increment or restart value of A1. Try below sub. You have to insert below codes inside your refresh sub.

Sub inc()
    If Range("A1") < Range("B1") Then
        Range("A1") = Range("A1") + 1
    Else
        Range("A1") = 1
    End If
End Sub
Harun24hr
  • 30,391
  • 4
  • 21
  • 36