Sub LoadSQLToSheet(sSQL As String)
'Load results to active cell 'CreateSheet sTicker Dim rs As ADODB.Recordset Dim i As Long Set rs = GetRecordset(sSQL) For i = 0 To rs.Fields.Count - 1 ActiveCell = rs(i).Name If rs(i).Type = adDBTimeStamp Then Columns(i + 1).NumberFormat = "mm/dd/yy" End If Right1 Next Down1 Cells(AR, 1).Select Do While Not rs.EOF For i = 0 To rs.Fields.Count - 1 ActiveCell = rs(i) Right1 Next Down1 Cells(AR, 1).Select rs.MoveNext DoEvents Loop End Sub |