![]() |
macro codes
hi,
can anybody explain to me what does "not" do in the following code: With Sheets("Sheet1").OptionButton1 'code name for the button .Value = Not .Value End With thanks |
macro codes
The optionbutton's value can be true or false.
Not true = false not false = true The code toggles the optionbutton from checked to unchecked or vice versa. peyman wrote: hi, can anybody explain to me what does "not" do in the following code: With Sheets("Sheet1").OptionButton1 'code name for the button .Value = Not .Value End With thanks -- Dave Peterson |
macro codes
The "Not" operator flips the bits, changing a 0 bit to a 1 bit. Generally,
you would use this only with TRUE and FALSE values to toggle between the two (TRUE = NOT FALSE, FALSE = NOT TRUE), but it can be used with any number. E.g., Not &h000000FF = &hFFFFFF00 If it is used with number other than -1 (TRUE) and 0 (FALSE), it would be confusing and quite possibly wrong. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting www.cpearson.com (email on the web site) "peyman" wrote in message ... hi, can anybody explain to me what does "not" do in the following code: With Sheets("Sheet1").OptionButton1 'code name for the button .Value = Not .Value End With thanks |
macro codes
thanx I got it.
"Dave Peterson" wrote: The optionbutton's value can be true or false. Not true = false not false = true The code toggles the optionbutton from checked to unchecked or vice versa. peyman wrote: hi, can anybody explain to me what does "not" do in the following code: With Sheets("Sheet1").OptionButton1 'code name for the button .Value = Not .Value End With thanks -- Dave Peterson |
macro codes
thank you for your explanation.
"Chip Pearson" wrote: The "Not" operator flips the bits, changing a 0 bit to a 1 bit. Generally, you would use this only with TRUE and FALSE values to toggle between the two (TRUE = NOT FALSE, FALSE = NOT TRUE), but it can be used with any number. E.g., Not &h000000FF = &hFFFFFF00 If it is used with number other than -1 (TRUE) and 0 (FALSE), it would be confusing and quite possibly wrong. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting www.cpearson.com (email on the web site) "peyman" wrote in message ... hi, can anybody explain to me what does "not" do in the following code: With Sheets("Sheet1").OptionButton1 'code name for the button .Value = Not .Value End With thanks |
All times are GMT +1. The time now is 08:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com