![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 22
|
I want to switch background color of the cell to red and then gradually go back to no background color in next 3-4 sec. in rsponse to specific condition. Basically, after cell background becomes i.e red it will dim itselft off within specific period of time i.e. 5sec.
Is there an easy way to do this? thanks |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
How about something like the following:
Sub FadeAway() Selection.Interior.ColorIndex = 3 Application.Wait (Now + TimeValue("0:00:01")) Selection.Interior.ColorIndex = 46 Application.Wait (Now + TimeValue("0:00:01")) Selection.Interior.ColorIndex = 45 Application.Wait (Now + TimeValue("0:00:01")) Selection.Interior.ColorIndex = 44 Application.Wait (Now + TimeValue("0:00:01")) Selection.Interior.ColorIndex = 36 Application.Wait (Now + TimeValue("0:00:01")) Selection.Interior.ColorIndex = xlNone End Sub It will fade from red to nothing in about 5 seconds.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
Hi Waldi and Al,
I just want to mention that it is possible to modify Al's macro to dim the cell in such a way that user input is not locked out during the 5 seconds that the macro is running. This can be done by using OnTime rather than Wait for the one second between color changes.
__________________
Keep Excelling. Damon VBAexpert Excel Consulting (My other life: http://damonostrander.com ) |
|
|
|
|
|
#4 |
|
New Member
Join Date: May 2002
Posts: 22
|
Thanks for the info.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|