- 帖子
- 1018
- 主題
- 15
- 精華
- 0
- 積分
- 1058
- 點名
- 0
- 作業系統
- win7 32bit
- 軟體版本
- Office 2016 64-bit
- 閱讀權限
- 50
- 性別
- 男
- 來自
- 桃園
- 註冊時間
- 2012-5-9
- 最後登錄
- 2022-9-28
|
回復 1# li_hsien
參考- Static Sub SetRangeFlashing(Optional Target, Optional ColorIndex, Optional bQuit As Boolean)
- '使用方法:
- ' 要開始閃爍請呼叫:SetRangeFlashing Target:=Range("A1:B2,C3"), ColorIndex:=3
- ' 要停止閃爍請呼叫:SetRangeFlashing bQuit:=True
- Dim dteNextTime As Date
- Dim bStatus As Boolean
- Dim RecordColor
- Dim rngFlash As Range
-
- If bQuit Then
- rngFlash.Interior.ColorIndex = RecordColor
- Application.OnTime dteNextTime, "SetRangeFlashing", , False
- Else
- If Not IsMissing(Target) Then Set rngFlash = Target
- If Not IsMissing(ColorIndex) Then RecordColor = ColorIndex
-
- rngFlash.Interior.ColorIndex = IIf(bStatus, RecordColor, xlColorIndexNone)
- bStatus = Not bStatus
- dteNextTime = Now + TimeValue("00:00:01")
- Application.OnTime dteNextTime, "SetRangeFlashing"
- End If
- End Sub
複製代碼 |
|