Sub test()
Dim i&, j&, k&, v&, m&
Dim arr, brr, crr, ss, dd
Application.ScreenUpdating = False
arr = Sheets("数据").[a1].CurrentRegion
ReDim brr(1 To UBound(arr) * 3, 1 To 17)
For i = 2 To UBound(arr)
ss = Split(arr(i, 6), "||") '灰水系统
crr = Split(arr(i, 9), "||") '黑水系统
dd = Split(arr(i, 12), "||") '分离器
v = v + 1
brr(v, 1) = arr(i, 1)
brr(v, 2) = arr(i, 2)
brr(v, 3) = arr(i, 3)
brr(v, 4) = Application.Text(arr(i, 4), "00")
brr(v, 5) = Application.Text(arr(i, 5), "00")
brr(v, 9) = Application.Text(arr(i, 7), "00")
brr(v, 10) = Application.Text(arr(i, 8), "00")
brr(v, 14) = Application.Text(arr(i, 10), "00")
brr(v, 15) = Application.Text(arr(i, 11), "00")
For j = 0 To UBound(ss)
ss1 = Split(ss(j), ":")
If Trim(ss1(0)) = "真空泵" Then
brr(v, 6) = ss1(1)
ElseIf Trim(ss1(0)) = "排污泵" Then
brr(v, 7) = ss1(1)
ElseIf Trim(ss1(0)) = "状态" Then
brr(v, 8) = ss1(1)
End If
For k = 0 To UBound(crr)
ss1 = Split(crr(k), ":")
If Trim(ss1(0)) = "真空泵" Then
brr(v, 11) = ss1(1)
ElseIf Trim(ss1(0)) = "排污泵" Then
brr(v, 12) = ss1(1)
ElseIf Trim(ss1(0)) = "状态" Then
brr(v, 13) = ss1(1)
End If
For m = 0 To UBound(dd)
ss1 = Split(dd(m), ":")
If Trim(ss1(0)) = "补水泵" Then
brr(v, 16) = ss1(1)
ElseIf Trim(ss1(0)) = "状态" Then
brr(v, 17) = ss1(1)
End If
Next
Next
Next
Next
With Sheets("想要的结果")
.[a2].CurrentRegion.Offset(1).Resize(v, 17).Clear
.[a3].Resize(v, 17) = brr
.[a3].CurrentRegion.Resize(v, 17).Borders.LineStyle = 1
End With
Erase arr
Erase brr
Application.ScreenUpdating = True
End Sub |