Strange result.. what am I missing ?

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,949
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Rtype is an integer = 10

Debug.Print RType And 1.

Result = 0 and I believe this is correct

rtype= 1010
1 = 0001
Result 0000

But in code my next line is 'If RType And 1 = 1 Then '.... and it executes the Then clause even though RType And 1 is not 1.

Why would this be ?

Thanks, ADKM
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try: If (RType And 1) = 1 Then

A roundabout way of checking odd/even, or just testing for something bigger?
 
Upvote 0
Thanks Stephen - sanity restored :biggrin: I'm using it with 4 checkboxes to action just those ticked. Probably more/better
ways but this seemed suitable... then bugged the hell out of me when it wouldn't work.
 
Upvote 0

Forum statistics

Threads
1,221,204
Messages
6,158,506
Members
451,497
Latest member
something68

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top