Comparison is failing

Achtel

New Member
Joined
Jun 9, 2014
Messages
2
I have a line of VBA code that should be returning TRUE but doesn't... does anybody have any thoughts as to why this could be?

Code:
If Left(Range("Y" & a).Value,1) = roll_day Then ...

I have added a watch to "Left(Range("Y" & a).Value,1) and roll_day. At the time the comparison is supposed to be done the Left(...) command shows the content as "9" and roll_day is showing as 9, yet the code doesn't go into the Then clause.

Any thoughts as to why this may be?

roll_day is a simple variable that has been defined as Range("AF5").Value

The cells in the Y column that this code cycles through are defined earlier as "Range("AF4").Value & "th " & Range("AG4").Value [essentially taking two input fields and turning them into a written date]
 
That works a treat, saves me the whole malarkey with Left(...) altogether as well. Thank you!
 
Upvote 0

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