|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
请见代码。
- Sub scada()
- Dim arr, i%, h%, r, rq, sj, t1, t2, t3, t4, t5, t6
- arr = [b2:d65]
- h = Hour(Now)
- r = Date
- For i = 1 To UBound(arr)
- rq = CDate(Split(arr(i, 1))(0)): sj = Hour(arr(i, 1))
- If rq = r Then
- Select Case sj
- Case h
- t1 = arr(i, 2)
- Case h - 1
- t2 = arr(i, 2)
- Case 8
- t3 = arr(i, 2)
- End Select
- ElseIf rq = r - 1 Then
- Select Case sj
- Case h
- t4 = arr(i, 2)
- Case h - 1
- t5 = arr(i, 2)
- Case 8
- t6 = arr(i, 2)
- End Select
- End If
- Next
- If t1 <> "" Then
- MsgBox "此时进站压力:" & t1 & " 1小时前进站压力:" & t2 & " 今天8点进站压力:" & t3 & Chr(13) & "昨天此时进站压力:" & t4 & " 昨天前1小时前进站压力:" & t5 & " 昨天8点进站压力:" & t6
- End If
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|