Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Dim objCon1 As ADODB.Connection, dataSQL As String, dataRS1 As ADODB.Recordset Set wb = ThisWorkbook Set P_ws = wb.Worksheets("SECDATA") Set PL_ws = wb.Worksheets("PLDATA") Set output_ws = wb.Worksheets("Output") output_ws.Cells.ClearContents Set objCon1 = New ADODB.Connection objCon1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & ThisWorkbook.FullName & ";" & _ "Extended Properties=""Excel 8.0;HDR=Yes;"";" dataSQL = "SELECT distinct p.COPYID as ID, d.* " & _ "FROM [PLDATA$] as p, [SECDATA$] as d " & _ "WHERE p.[CCodes] = d.TICKER " Set dataRS1 = New ADODB.Recordset dataRS1.Open dataSQL, objCon1 y = 1 For Each fld In dataRS1.Fields output_ws.Cells(1, y).Value = fld.Name y = y + 1 Next output_ws.Cells(2, 1).CopyFromRecordset dataRS1 objCon1.Close Set objCon1 = Nothing Set dataRS1 = Nothing
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.