View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default toggle between 0 and 1

Assuming your variable's name is ZeroOne, executing this statement will
toggle it from 1 to 0 or 0 to 1 depending on its current value...

ZeroOne = 1 - ZeroOne

--
Rick (MVP - Excel)


"Robert Crandal" wrote in message
...
Is there a binary operator in Visual Basic
that will toggle a variable (initially set to 0)
between 0 and 1???

I know I could use a bunch of if-then statements
to toggle my variable between 0 and 1, but isnt
there a binary operator that can set my variable
to 0 if it equals 1, and set it to 1 if it equals 0???

thankx