- ©«¤l
- 353
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 386
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-5-4
|
¦^´_ 8# 198188
Sub test()
Set cn = CreateObject("adodb.connection"): V = Application.Version
If V >= 12 Then V = "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 12.0;"
If V < 12 Then V = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;"
cn.Open V & "Data Source=" & ThisWorkbook.FullName
q = "select top 10 " & Sheet1.[A1] & ", [" & Sheet2.[C1] & "] from [" & Sheet1.Name & "$A1:L]"
q = q & " order by [" & Sheet2.[C1] & "] desc"
Sheet2.[C4].CopyFromRecordset cn.Execute(q)
End Sub
Xl0000096.zip (22 Bytes)
|
|