Excel VBA / SQL Union -


I am trying to join 2 different columns to create a long column in 2 different columns From which I can use Vlookup again.

sheet 1a, b, c, d, e, f, g

sheet 2a, b, c, d, e, f, g

I (Union) in column B want to join Sheet1 and C2 to C and find different values ​​for the new list. I am working on this for weeks.

Thanks

You can use ADO with Excel. String Dim as String Dim as String Dim Strakon as String Dim Stracon in the form of String Dim Stracon as Object Dim RSI in the form of the DM CNI Object Dim RS as the string DMRSSQL stringDim. As an integer, as J Integer, "it is not the best way to refer to the workbook" "You want but for notes It's very sensitive '' It's probably best to use the name of the workbook 'StrFile = ActiveWorkbook.FullName' 'Note that if HDR = No, F1, F2 etc. is used for column names, then' HDR = Yes, the name 'can be used in the first line of the category. "This is a Jet 4 connection string, you can get more" here: http://www.connectionstrings.com/excel strCon = "provider = Microsoft.Jet.OLEDB.4.0; data source =" & amp; Strong_ and amp; "; Extended Properties =" "Excel 8.0; HDR = Yes; IMX =" 1 ";" '' Is late-binding, so do not require any reference set cn = CreateObject ("ADODB.Connection") set rs = CreateObject ("ADODB.Recordset") cn.Open strCon "Select a sample query strSQL =" A clear, from BC and select from A, B, C "_" and "From [Sheet 1 $]" _ and "Union All" _ and "Select A, B, C" _ and "From [ Sheet 2 $]) "Open Records for More Processing" in the form of J. Cursor type: 3, adOpenStatic '' Lock type: 3, adLockOptimistic '' Everything with type and lock type is not everything See http://www.w3schools.com/ado/met_rs_open.asp rs.Open strSQL, cn, 3, 3 '' Write data to blank sheet (no headers) Worksheets ("Sheet 3"). Cell (2, 1) .CopyFromRecordset RSS


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -