VBA コードで Excel 列の値を検索する方法 Cells.Find 質問する

VBA コードで Excel 列の値を検索する方法 Cells.Find 質問する

価値を見つけなければならないセルダExcel シートで、次の VBA コードを使用して検索しました。

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の列のみ次のコードで見つけました:

    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

ベストアンサー1

ただ使うだけ

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

おすすめ記事