|
这个地方我改了一下,总表只有第一行的时候,运行会出错
With Worksheets(1)
ar = .Range("A1").CurrentRegion.Value
iRow = .Cells(.Rows.Count, 1).End(3).Row
If iRow > 1 Then
For i = 2 To UBound(ar)
If Len(ar(i, 1)) Then If Not Dict.Exists(ar(i, 1)) Then Dict.Add ar(i, 1), vbNullString
Next i
SQL = SQL & strWhere
SQL = "SELECT * FROM (" & SQL & ") WHERE 入库单号 NOT IN ('" & Join(Dict.Keys, "','") & "')"
Else
SQL = SQL & strWhere
End If
.Range("A" & Rows.Count).End(3).Offset(1).CopyFromRecordset Conn.Execute(SQL)
.Activate
End With |
评分
-
1
查看全部评分
-
|