How Do I Convert an Integer to a String in Excel VBA?

后端 未结 10 1775
遥遥无期
遥遥无期 2020-12-07 15:53

How do I convert the integer value \"45\" into the string value \"45\" in Excel VBA?

10条回答
  •  感动是毒
    2020-12-07 16:33

    If you have a valid integer value and your requirement is to compare values, you can simply go ahead with the comparison as seen below.

    Sub t()
    
    Dim i As Integer
    Dim s  As String
    
    ' pass
    i = 65
    s = "65"
    If i = s Then
    MsgBox i
    End If
    
    ' fail - Type Mismatch
    i = 65
    s = "A"
    If i = s Then
    MsgBox i
    End If
    End Sub
    

提交回复
热议问题