How to work with arrays and display them in a MsgBox VBA
<p>I need to write a sub that take a single argument from an input box that searches a stock price in a list. The sub searches down the list of prices from "B3:B20" and when it finds the first price that exceeds this price it displays the date which is displays in the column next to it in column A in a msgbox. This is the code I have so far but I am having trouble figuring out how to display the corresponding data for the price found:(I believe the problem has to do with the array created)</p>

<pre><code>Sub RecordHigh1()
Dim searchPrice As Currency
Dim rng As Range
Dim date1() As String
Dim price() As String
Dim nDates As Integer
Dim i As Integer



With wsData.Range("A3")
nDates = Range("A3", Range("A3").End(xlDown).Value)
ReDim date1(1 To nDates)
ReDim price(1 To nDates)
For i = 1 To nDates
    date1(i) = .Offset(i, 0).Value
    price(i) = .Offset(i, 1).Value
Next
End With


searchPrice = InputBox("Enter a Price")
Set rng = Range("B3", Range("B3").End(xlDown).Address)

For Each cell In rng
If cell.Value &gt; searchPrice Then
MsgBox "The first date WalTech stock price exceeded " &amp; searchPrice &amp; " was &amp; date(i) =.Offset(i, 0).Value &amp; "
Else
MsgBox "WalTech stock has not exceeded this price"
End If
Next



End Sub
</code></pre>