#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Codes sam Excel Discussion (Misc queries) 2 September 11th 07 02:04 PM
VB Codes bowling Excel Discussion (Misc queries) 0 July 30th 07 07:02 PM
Need some macro codes zen65 Excel Discussion (Misc queries) 4 May 24th 07 06:15 PM
codes, codes, codes... jatman Excel Discussion (Misc queries) 2 August 20th 06 07:30 AM
hiding macro codes upon protecting the worksheet eehj23 Excel Discussion (Misc queries) 1 April 28th 06 03:55 AM


All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"