以下代码,数据在sheet1的A到D列,表头在第二行
取前三个复制到H列
Set conn = CreateObject("adodb.connection")
conn.Open "provider=microsoft.jet.oledb.4.0;extended properties=excel 8.0;data source=" & ThisWorkbook.FullName
Sql = "select top 3 * from [sheet1$A2:D] order by 销量 desc"
[H3].CopyFromRecordset conn.Execute(Sql)
conn.Close: Set conn = Nothing
[A2:D2].Copy [H2]