|
Sub 按品位回收率汇总()
Dim ar As Variant
Sheets("品位-回收率").Cells(1, 1) = "工作表名称"
Sheets("品位-回收率").Cells(1, 2) = "班次"
Sheets("品位-回收率").Cells(1, 3) = "原矿金品位"
Sheets("品位-回收率").Cells(1, 4) = "原矿银品位"
Sheets("品位-回收率").Cells(1, 5) = "原矿铅品位"
Sheets("品位-回收率").Cells(1, 6) = "铅回收率"
Sheets("品位-回收率").Cells(1, 7) = "金回收率"
Sheets("品位-回收率").Cells(1, 8) = "银回收率"
Sheets("品位-回收率").Cells(1, 9) = "铅精矿产率"
Sheets("品位-回收率").Cells(1, 10) = "铅精矿铅品位"
Sheets("品位-回收率").Cells(1, 11) = "铅精矿金品位"
Sheets("品位-回收率").Cells(1, 12) = "铅精矿银品位"
Sheets("品位-回收率").Cells(1, 13) = "金精矿产率"
Sheets("品位-回收率").Cells(1, 14) = "金精矿金品位"
Sheets("品位-回收率").Cells(1, 15) = "金精矿银品位"
Sheets("品位-回收率").Cells(1, 16) = "金精矿铅品位"
Sheets("品位-回收率").Cells(1, 17) = "尾矿铅品位"
Sheets("品位-回收率").Cells(1, 18) = "尾矿金品位"
Sheets("品位-回收率").Cells(1, 19) = "尾矿银品位"
Dim arr()
a = InputBox("请输入品位")
ReDim arr(1 To 100000, 1 To 19)
For Each sh In Sheets
If sh.Name <> "汇总" Then
r = sh.Cells(Rows.Count, 2).End(xlUp).Row
ar = sh.Range("a1:h" & r)
For i = 7 To UBound(ar)
If Trim(ar(i, 2)) = "日计" Then
If Not IsError(ar(i, 8)) Then
If ar(i, 8) > Val(a) Then
n = n + 1
arr(n, 1) = sh.Name
arr(n, 2) = sh.Cells(i, 1)
arr(n, 3) = sh.Cells(i, 8)
arr(n, 4) = sh.Cells(i, 10)
arr(n, 5) = sh.Cells(i, 6)
arr(n, 6) = sh.Cells(i, 43)
arr(n, 7) = sh.Cells(i, 44)
arr(n, 8) = sh.Cells(i, 45)
arr(n, 9) = sh.Cells(i, 15)
arr(n, 10) = sh.Cells(i, 16)
arr(n, 11) = sh.Cells(i, 18)
arr(n, 12) = sh.Cells(i, 19)
arr(n, 13) = sh.Cells(i, 25)
arr(n, 14) = sh.Cells(i, 26)
arr(n, 15) = sh.Cells(i, 27)
arr(n, 16) = sh.Cells(i, 29)
arr(n, 17) = sh.Cells(i, 37)
arr(n, 18) = sh.Cells(i, 39)
arr(n, 19) = sh.Cells(i, 40)
End If
End If
End If
Next i
End If
Next sh
If n = "" Then MsgBox "没有符合条件的品位!": End
With Sheets("品位-回收率")
.[a1].CurrentRegion.Offset(1) = Empty
.[a2].Resize(n, 19) = arr
.[a2].Resize(n, 19).Borders.LineStyle = 1
End With
MsgBox "ok!"
Sheets("品位-回收率").Activate
End Sub
|
|