Mn giúp em với, em mới tìm hiểu mà chỉ biết cách chạy code macro

Em muốn tổng hợp tổng số hàng trong kho theo mã mặt hàng, số chúng từ theo từng mặt hàng.
Em xem qua mà không áp dụng code được, nhấn chạy thì bị lỗi color ...
Có bác nào giúp em với, trong code đó cần chỉnh sửa ntn để phù hợp vs file của em ạ.
Em cảm ơn

Chạy thử code sau:
[GPECODE=sql]Sub TongHop()
Dim cn As Object, rst As Object, cat As Object, tbl As Object, str$, str1 As String
Set cn = CreateObject("ADODB.Connection")
Set cat = CreateObject("ADOX.Catalog")
Set tbl = CreateObject("ADOX.Table")
Set rst = CreateObject("ADODB.Recordset")
With cn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ThisWorkbook.FullName & _
";Extended Properties=""Excel 8.0;HDR=No;IMEX=1;"";"
.Open
End With
cat.ActiveConnection = cn
For Each tbl In cat.Tables
If Right(Replace(tbl.Name, "'", ""), 1) = "$" And tbl.Name <> "PXK$" And tbl.Name <> "TONG$" Then
str = str & " union all select F1,F2,F3,F4,F5,F6,F7,F8,F9 from [" & _
Replace(Replace(tbl.Name, "$", ""), "'", "") & "$A15:I200] WHERE F7 IS NOT NULL "
str1 = Right(str, Len(str) - 10)
End If
Next
With rst
.ActiveConnection = cn
.Open "select F2,F3,F4,sum(F6),sum(F7),VAL(F8),sum(F9) from (" & str1 & ") group by F2,F3,F4,F8"
End With
With Sheets("TONG")
.[A3:G65000].ClearContents
.[A3].CopyFromRecordset rst
End With
rst.Close: Set rst = Nothing
cn.Close: Set cn = Nothing
Set cat = Nothing: Set tbl = Nothing
End Sub
[/GPECODE]