[英]Find Function in VBA
我通过编写一个简单的演示
Sub search()
Range("B1:B7").Find("abc").Activate
End Sub
我希望excel将自动选择其中包含值“ abc”的单元格,但是,我收到一条错误消息,提示“对象变量或未设置块变量”。 我想念一切吗
欣赏它。
“ https://msdn.microsoft.com/en-us/library/office/ff839746.aspx”
Sub tester()
With Worksheets(6).Range("B1:B500")
Set c = .Find("Smith Jon Junior", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address ' not required
c.Activate
else
msgbox ("Not Found")
End If
End With
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.