|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub datainput()
Dim a, i, j, k As Integer
Dim department()
Dim tarde()
Dim arr(1 To 37, 1 To 11)
department = Array("A1")
tarde = Sheet8.Range("B2:B38")
k = 1
a = Sheet7.[D65536].End(3).Row
For i = 0 To UBound(department)
For j = 1 To UBound(tarde) -1
arr(k, 1) = Application.Evaluate("application.worksheetfunction.sumproduct((range(""D2:D28000"")=" & tarde(j,1) & ")*(range(""E2:E28000"")=" & department(i) & ")*(range(""F2:F28000"")))")
'arr(k,2)=
k = k + 1
Next j
Sheets(department(i)).Cells(a + 1, 4).Resize(37, 11) = arr
Next i
End Sub
经高人解答tarde = Sheet8.Range("B2:B38")将生成只有一列的二维数组。原问题搞定。
又出新问题了,计算的结果都是:#name!怎么回事啊?(D列和E列都是文本F列是数值)
[ 本帖最后由 ideal77 于 2009-11-17 15:11 编辑 ] |
|