我正在寻找长度为1或2个字符的单元格。这是代码:
Set c = .Find(Len(c.Value) = 2 Or 1, LookIn:=xlValues)
您可以使用循环而不是FIND():
Sub durale()
For Each r In ActiveSheet.UsedRange
If Len(r.Value) = 2 Or Len(r.Value) = 1 Then
Set c = r
Exit For
End If
Next r
If c Is Nothing Then
MsgBox "nothing found"
Else
MsgBox "cell " & r.Address(0, 0) & "contains " & r.Value
End If
End Sub
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句