|
- Sub 插入()
- Dim CNN As Object, ARR, ST As String, X As Integer, SQL As String
- Set CNN = VBA.CreateObject("ADODB.CONNECTION")
- CNN.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ThisWorkbook.Path & "\data.accdb"
- ARR = Range("B2:F" & Range("B65536").End(xlUp).Row + 1)
- For X = 1 To UBound(ARR) - 1 Step 1
- ST = "'" & ARR(X, 1) & "','" & ARR(X, 5) & "'"
- SQL = "INSERT INTO 不合格汇总 ([ACC Number],Problem) VALUES (" & ST & ")"
- CNN.Execute SQL, , adExecuteNoRecords
- Next X
- CNN.Close
- Set CNN = Nothing
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|