Excel的vba能否实现SQL的这项功能?
select a1,a2,a3,a4,a5,a6 From [Tbale$] Where a1=数据1 and a2=数据2 and a3=数据3 and a4=数据4
用AutoFilter功能只能有两个条件,
Find本身只有一个功能,是需要多个find命令组合而成,???
------解决方案--------------------------------------------------------
看个例子:
Sub Macro1()
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Book1.xls;Jet OLEDB:Engine Type=35"), Destination:=Range("C1"))
.CommandType = xlCmdSql
.CommandText = Array("select distinct A from [Sheet1$] where A in (select distinct B from [Sheet1$])")
.Refresh BackgroundQuery:=False
End With
End Sub