VBA 中获得变量的类型:TypeName

Dim shtInvoice As Worksheet
Dim strInput As String

Private Sub btnQuery_Click()
    strInput = tbInput.Value
    Set shtInvoice = Worksheets("出货")
    For Each c In shtInvoice.Cells
        If c.Value = strInput Then
            MsgBox TypeName(c)
            Exit For
        End If
    Next
End Sub

 

结果是:Range

posted on 2010-11-22 15:38  冰危节奏  阅读(6535)  评论(0)    收藏  举报

导航