Hi friends,
the other day, someone posted an issue on the web asking why the statement "i < ActiveSheet.Rows.Count" returns False, in which the variable "i" is declared as a String and is assigned an integer value 3.
I have been thinking about this problem for two days and still can't figure out why. Here is a small demo sub procedure that can illustrate what I'm trying to explain.
Specifically, I wanted to find some explanation in [MS-VBAL], the official VBA language specification.
[MS-VBAL]: VBA Language Specification
Any help would be appreciated.
the other day, someone posted an issue on the web asking why the statement "i < ActiveSheet.Rows.Count" returns False, in which the variable "i" is declared as a String and is assigned an integer value 3.
I have been thinking about this problem for two days and still can't figure out why. Here is a small demo sub procedure that can illustrate what I'm trying to explain.
VBA Code:
Option Explicit
Sub CompareStringWithVariant()
Dim a As String
Dim b As Variant
a = 3
For b = 1 To 30
Debug.Print "3 < " & CStr(b) & ": " & (a < b)
Next b
End Sub
Specifically, I wanted to find some explanation in [MS-VBAL], the official VBA language specification.
[MS-VBAL]: VBA Language Specification
Any help would be appreciated.