|
今晚网络不正常,也不知道附件有没有上传。
Sub bom_buyer_code()
Dim ADO As Object, Arr As Variant, StrCri$, StrSQL$
Rows("2:10000").ClearContents
Set ADO = CreateObject("adodb.connection")
Arr = Sheet4.Range("B2:B" & Sheet4.Range("A" & Sheet4.Rows.Count).End(xlUp).Row)
StrCri = Join(WorksheetFunction.Transpose(Arr), "','")
ADO.Open "provider=microsoft.ace.oledb.12.0;extended properties=excel 12.0;data source=" & ThisWorkbook.FullName
StrSQL = "select * from [excel 12.0;database=" & ThisWorkbook.FullName & "].[Pr_Not_Convert$] where [Buyer Code] in('" & StrCri & "')"
Sheet9.Range("A2").CopyFromRecordset ADO.Execute(StrSQL)
Set ADO = Nothing
End Sub |
|