Hello everyone.
This isn't really a problem, cause I solved it easily by explicit int conversion. But something weird happens in this code which diverges from my understanding of VB workings, and I'm trying to find out what's going on. Wondering if some expert could explain.
GameNo contains "4830" (string), and LastGame contains 4830. Yet second part of if condition yields True. LastGame/FirstGame/GameNo aren't declared with Dim, and when LastGame is declared as Dim LastGame As Integer everything works as expected.![]()
If GameNo < FirstGame Or GameNo > LastGame Then MsgBox "Game number " & GameNo & " not present in the sheet." Exit Sub End If
So I was wondering if this is some bug, or there are some additional rules with converting from/to variant types?
See this image for more details:
vba-weird-situation.png
Thank you very much!
P.S. It's Excel 2003
Bookmarks