Home > database >  Volatile function (can be macro) that allows me to alternate between two values
Volatile function (can be macro) that allows me to alternate between two values

Time:08-19

I want to create a "turn" system. I want my spreadsheet to return in one cell, one of the two values I have in a column, but I want it to return in an order

Column A Column B
TEXT 1 Return value
TEXT 2

In the return value cell, I want to show TEXT 1, after I have run another macro I want that to change to TEXT 2, and continue to alternate between the two values forever, i.e return T1, action, return T2, action, return T1, etc.

CodePudding user response:

What about this simple macro?

Sub ChVal()
    If Range("B1") = Range("A1") Then
        Range("B1") = Range("A2")
    Else
        Range("B1") = Range("A1")
    End If
End Sub
  • Related