I don't know if this is any use:
Sub Search()
Dim rngHeading As Range, rngSubheading As Range
Dim strHeading As String, strSubHeading As String
strHeading = InputBox("Enter the heading to find")
strSubHeading = InputBox("Enter the sub-heading to find")
With Worksheets(1).Range("A1:A10000") 'search this range on sheet1
Set rngHeading = .Find(What:=strHeading, After:=Range("A1"), LookIn:=xlValues, LookAt:=xlPart) 'heading search
If Not rngHeading Is Nothing Then
Set rngSubheading = .Find(What:=strSubHeading, After:=rngHeading, LookIn:=xlValues, LookAt:=xlPart) 'sub-heading search
If Not rngSubheading Is Nothing Then
rngSubheading.Offset(, 1).Activate 'activate the value and display message
MsgBox "Heading: " & strHeading & vbCrLf & _
"Sub-heading: " & strSubHeading & vbCrLf & _
"Value: " & rngSubheading.Offset(, 1).Value, vbInformation
Else
MsgBox "Heading " & strHeading & " was found, but" & vbCrLf & _
"Sub-heading " & strSubHeading & " was not found", vbExclamation
End If
Else
MsgBox "Heading " & strHeading & " was not found", vbExclamation
End If
End With
Set rngHeading = Nothing
Set rngSubheading = Nothing
End Sub
Bookmarks