|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:m" & r)
- For j = 1 To UBound(arr, 2)
- If arr(1, j) <> "液位" And arr(1, j) <> "压力" Then
- arr(2, j) = 0
- arr(3, j) = 0
- arr(4, j) = 0
- m = 0
- For i = 5 To UBound(arr)
- Select Case arr(i, j)
- Case "运行"
- m = 2 '
- Case "停止"
- m = 3
- Case "故障"
- m = 4
- End Select
- If m <> 0 Then
- arr(m, j) = arr(m, j) + 1
- End If
- Next
- arr(2, j) = "运:" & arr(2, j)
- arr(3, j) = "停:" & arr(3, j)
- arr(4, j) = "障:" & arr(4, j)
- End If
- Next
- .Range("a2:m" & r) = arr
- End With
-
-
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|