Sub 汇总数据_()
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strsql As String
Dim str1 As String
On Error Resume Next
Set cnn = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
cnn.Open "provider=microsoft.jet.oledb.4.0;" _
& "extended properties=excle 8.0;" _
& "data source=" & ThisWorkbook.FullName
strsql = "select 商品名称,sum(期初库存) from [数据库$] group by 商品名称"
rs.Open strsql, cnn, adOpenStatic
With Sheet1
.Range("a2:g1000").ClearContents
.Range("a2").CopyFromRecordset
End With
rs.colse
cnn.Close
Set rs = Nothing
Set cnn = Nothing
End Sub
02-13
684
11-07
1万+