Sub lll() Dim ii As Integer, j As Integer, COUNTER As Integer Dim yc1 As String COUNTER = Application.WorksheetFunction.Min(Worksheets("temp").Range("E1:E2")) For ii = 6 To 7 Set x = CreateObject("ADODB.Connection") x.Open "provider=microsoft.jet.oledb.4.0;extended properties=excel 8.0;data source=" & ThisWorkbook.Path & "\" & Cells(ii, 1) & ".xls" For j = 1 To COUNTER yc1 = Worksheets("temp").Cells(ii - 5, j + 8).Value
Sql = "select sum(" & yc1 & ") from [" & Worksheets("fplevel").Cells(2, 2) & "$] where Fampar='" & Worksheets("fplevel").Cells(17, 1) & "'" Set yy = x.Execute(Sql) Sheets("fplevel").Cells(17, j + 2).CopyFromRecordset yy Set yy = Nothing Next Set x = Nothing Next
End Sub 请教高亮这句语法有问题吗? 我单步运行,在这句就出问题了。。。。[em06][em06][em06][em06] 谢谢!
[此贴子已经被作者于2006-6-11 12:05:57编辑过] |