Forum Discussion
Filtering between sheets
VBA:
Set Conn = CreateObject("ADODB.Connection")
'
Conn.Open "Provider=Microsoft.Ace.OLEDB.12.0;Extended Properties='Excel 12.0; HDR=NO;IMEX=VBA:
Set Conn = CreateObject("ADODB.Connection")
'
Conn.Open "Provider=Microsoft.Ace.OLEDB.12.0;Extended Properties='Excel 12.0; HDR=NO;IMEX=1';Data Source=" & ThisWorkbook.FullName
Set Rst=CreateObject("ADODB.Recordset")
'sql1="select f1,* from [Sheet1$] where instr(f1&f2,?)>0"
sql1="select f1 from `ALLE$`"
sql2="(select f3 from `BETAALD$`)"
sql=sql1 & " where f1 not in " & sql2
set cmd=CreateObject("ADODB.command")
With cmd
Set .ActiveConnection = Conn
.CommandType = 1 'adCmdText
.CommandText =sql
'Set parm1 = '.CreateParameter("uName",200,1,200,"aa")
'.Parameters.Append parm1
set Rst=.Execute()
end with
msgbox sql
ActiveCell.CopyFromRecordset Rst
'FilterArr=Rst.getrows()
Rst.close
Conn.close3';Data Source=" & ThisWorkbook.FullName
Set Rst=CreateObject("ADODB.Recordset")
'sql1="select f1,* from [Sheet1$] where instr(f1&f2,?)>0"
sql1="select f1 from `ALLE$`"
sql2="(select f3 from `BETAALD$`)"
sql=sql1 & " where f1 not in " & sql2
set cmd=CreateObject("ADODB.command")
With cmd
Set .ActiveConnection = Conn
.CommandType = 1 'adCmdText
.CommandText =sql
'Set parm1 = '.CreateParameter("uName",200,1,200,"aa")
'.Parameters.Append parm1
set Rst=.Execute()
end with
msgbox sql
ActiveCell.CopyFromRecordset Rst
'FilterArr=Rst.getrows()
Rst.close
Conn.close