Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In Excel 2000 VBA, is there one single command to toggle a Boolean - that
is, in whatever state it's in, change it to the opposite? I know it can be done with an If / Else - I was just wondering if there was a singe-line way to do it. Ed |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ed wrote:
In Excel 2000 VBA, is there one single command to toggle a Boolean - that is, in whatever state it's in, change it to the opposite? I know it can be done with an If / Else - I was just wondering if there was a singe-line way to do it. Ed ---------------- Dim Flag as Boolean Flag = not(Flag) Bill |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Bill.
"Bill Martin" wrote in message ... Ed wrote: In Excel 2000 VBA, is there one single command to toggle a Boolean - that is, in whatever state it's in, change it to the opposite? I know it can be done with an If / Else - I was just wondering if there was a singe-line way to do it. Ed ---------------- Dim Flag as Boolean Flag = not(Flag) Bill |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ed,
Use the Not operator. This will switch a boolean to its opposite. E.g, Dim Var As Boolean Dim Var As Boolean Var = Not Var -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ed" wrote in message ... In Excel 2000 VBA, is there one single command to toggle a Boolean - that is, in whatever state it's in, change it to the opposite? I know it can be done with an If / Else - I was just wondering if there was a singe-line way to do it. Ed |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have no idea how I got two Dim statements in the code. The
code should have only one Dim Statement. Dim Var As Boolean Var = Not Var -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... Ed, Use the Not operator. This will switch a boolean to its opposite. E.g, Dim Var As Boolean Dim Var As Boolean Var = Not Var -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ed" wrote in message ... In Excel 2000 VBA, is there one single command to toggle a Boolean - that is, in whatever state it's in, change it to the opposite? I know it can be done with an If / Else - I was just wondering if there was a singe-line way to do it. Ed |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Chip.
"Chip Pearson" wrote in message ... I have no idea how I got two Dim statements in the code. The code should have only one Dim Statement. Dim Var As Boolean Var = Not Var -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... Ed, Use the Not operator. This will switch a boolean to its opposite. E.g, Dim Var As Boolean Dim Var As Boolean Var = Not Var -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ed" wrote in message ... In Excel 2000 VBA, is there one single command to toggle a Boolean - that is, in whatever state it's in, change it to the opposite? I know it can be done with an If / Else - I was just wondering if there was a singe-line way to do it. Ed |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Command button to toggle worksheet event code on / off? | Excel Discussion (Misc queries) | |||
Boolean comparison: range vs. single cell | Excel Worksheet Functions | |||
Toggle command buttons | Excel Programming | |||
Toggle multiple values in single cell | Excel Worksheet Functions | |||
Single command button to select one of several choices. | Excel Programming |