I put resume (plus some additional code) in the error handler and that cleared up the first issue if symbol is not found in column A. Still having trouble if the user enters and invalid date in column B (e.g. enters a Saturday, Sunday, holiday, etc). Not sure if I need another resume someplace in the code and I am just not seeing it.
Option Explicit
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim HSDFY As HistoricalStockDataFromYahoo
Dim rs As ADODB.Recordset
Dim i As Long
Dim j As Integer
Dim lastrow As Integer
On Error GoTo Err_CommandButton1_Click
Range("C2:D" & Rows.Count).ClearContents
i = 2
lastrow = Range("A" & Rows.Count).End(xlUp).Row
For j = 2 To lastrow
Set HSDFY = New HistoricalStockDataFromYahoo
Set rs = HSDFY.GetHistoricalData(Cells(j, 1).Value, Cells(j, 2).Value, Cells(j, 2).Value)
rs.MoveFirst
Cells(j, 3).CopyFromRecordset rs
i = i + 1
Next j
Exit Sub
Err_CommandButton1_Click:
Select Case Err.Number
Case 10000
MsgBox Err.Description
j = j + 1
i = i + 1
Resume
Case 10001
'invalid interval
MsgBox Err.Description
j = j + 1
i = i + 1
Resume
Case 10002
'query failed
MsgBox Err.Description
j = j + 1
i = i + 1
Resume
End Select
Application.ScreenUpdating = True
End Sub
Bookmarks