Strange result.. what am I missing ?

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,119
Office Version
  1. 2019
  2. 2010
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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,225,477
Messages
6,185,213
Members
453,283
Latest member
Shortm88

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