エクセル シートから 文字 検索 vba | 備忘録 (。・_・。)ノ
Sub test()

Const SearchChar As String = "大阪"
Dim strSheetName As String

    Dim lngYLine As Long
    Dim intXLine As Integer
    Dim Obj As Object
    
    strSheetName = ActiveSheet.Name
    
    Set Obj = Worksheets(strSheetName).Cells.Find(SearchChar, LookAt:=xlWhole)
    If Obj Is Nothing Then
        MsgBox SearchChar & "は見つかりませんでした。"
    Else
        lngYLine = Worksheets(strSheetName).Cells.Find(SearchChar, LookAt:=xlWhole, SearchDirection:=xlPrevious).Row
        intXLine = Worksheets(strSheetName).Cells.Find(SearchChar, LookAt:=xlWhole, SearchDirection:=xlPrevious).Column
        MsgBox SearchChar & "は、" + CStr(lngYLine) + "行目の" + CStr(intXLine) + "列目にあります"
        MsgBox lngYLine & "-" & intXLine
        MsgBox Worksheets(strSheetName).Cells(lngYLine, intXLine + 1)
    End If
    
    Set Obj = Nothing
    
End Sub