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
浙公网安备 33010602011771号