如何通过 vba 代码 Cells.Find 在 excel 列中查找值 [英] How to find a value in an excel column by vba code Cells.Find
本文介绍了如何通过 vba 代码 Cells.Find 在 excel 列中查找值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在 Excel 工作表中找到一个值 celda.我正在使用此 vba 代码来查找它:
I have to find a value celda in an Excel sheet. I was using this vba code to find it:
Set cell = Cells.Find(What:=celda, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False)
If cell Is Nothing Then
'do it something
Else
'do it another thing
End If
问题是当我必须仅在 excel 列中查找值.我用下一个代码找到它:
The problem is when I have to find the value only in a excel column. I find it with next code:
Columns("B:B").Select
Selection.Find(What:="VA22GU1", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
但是我不知道如何将它适配到第一个 vba 代码中,因为我必须使用值 nothing
.
But I don't know how to adapt it to the first vba code, because I have to use the value nothing
.
推荐答案
就用
Dim Cell As Range
Columns("B:B").Select
Set cell = Selection.Find(What:="celda", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If cell Is Nothing Then
'do it something
Else
'do it another thing
End If
这篇关于如何通过 vba 代码 Cells.Find 在 excel 列中查找值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文