|
- Sub 查询()
- Dim aa As String, num As Integer
- For num = 1 To 9
- aa = aa & """" & [a1].Offset(num, 0) & ""","
- Next
- Range("C2:J65536").ClearContents
-
- Set cnn = CreateObject("Adodb.Connection")
- Set rst = CreateObject("Adodb.Recordset")
- Stpath = ThisWorkbook.Path & Application.PathSeparator & "Êý¾Ý¿â.mdb"
- cnn.Provider = "Microsoft.Jet.OLEDB.4.0"
- cnn.Open "Data Source =" & Stpath & ";Jet OLEDB:Database Password=" & ""
-
- 'Sql = "Select * From ³§¼Ò Where »úºÅ IN ('" & Range("A2") & "','" & Range("A3") & "','" & Range("A4") & "','" & Range("A5") & "','" & Range("A6") & "','" & Range("A7") & "','" & Range("A8") & "','" & Range("A9") & "','" & Range("A10") & "')"
- Sql = "Select * From ³§¼Ò Where »úºÅ IN (" & aa & ")"
- Range("C2").CopyFromRecordset cnn.Execute(Sql)
- Set rst = Nothing
- Set cnn = Nothing
- End Sub
复制代码
新建文件夹.rar
(33.13 KB, 下载次数: 95)
|
|