本文介绍了VBA电池内部颜色,从黑色逐渐消失为白色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Excel 2003,并且想知道将单元格的内部颜色从黑色更改然后逐渐淡入白色的最佳方法.

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.

推荐答案

尝试一下:

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

这篇关于VBA电池内部颜色,从黑色逐渐消失为白色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 02:02