问题
Im using Excel 2003 and would like to know the best way to change a cell's interior colour from black, and then gradually fade to white.
The idea being I will use the worksheet change event to slowly reveal some black text that is put into the cell in question.
回答1:
Try this:
Sub tester()
FadeToWhite Selection.Offset(1, 0)
End Sub
Sub FadeToWhite(c As Range)
Const SLOWNESS As Long = 300000
Dim i As Long, v
For i = 1 To 255 * SLOWNESS
If i Mod SLOWNESS = 0 Then
v = i / SLOWNESS
c.Interior.Color = RGB(v, v, v)
DoEvents
End If
Next i
End Sub
来源:https://stackoverflow.com/questions/24123413/vba-cell-interior-color-fade-from-black-to-white