Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Blinking text in random colour
Message
 
À
05/11/2002 04:29:14
Budi Irawan
Berlian Laju Tanker
Jakarta, Indonésie
Information générale
Forum:
Microsoft Office
Catégorie:
Excel
Divers
Thread ID:
00718840
Message ID:
00719068
Vues:
23
This message has been marked as the solution to the initial question of the thread.
Code such as this:
Option Explicit 'You Can remove this line if you want to leave out
'the "Dim" lines, but this is more effecient

Sub ChangeColors()
    Dim iColor As Integer
    Dim Counter As Integer
    For Counter = 1 To 20 'Number of changes
        'This next line is optional, but it helps show what it's doing
        ActiveSheet.Cells(1, 1).Value = Counter
        iColor = Int(Rnd * 55) + 1  '1 through 56
        ActiveSheet.Cells(1, 1).Interior.ColorIndex = iColor
        iColor = Int(Rnd * 55) + 1  '1 through 56
        ActiveSheet.Cells(1, 1).Font.ColorIndex = iColor
        WaitAWhile
    Next Counter
End Sub

Sub WaitAWhile()
    Dim NewHour As Date
    Dim NewMinute As Date
    Dim NewSecond As Date
    Dim WaitTime As Date
    NewHour = Hour(Now())
    NewMinute = Minute(Now())
    NewSecond = Second(Now()) + 1  'However many seconds between changes
    WaitTime = TimeSerial(NewHour, NewMinute, NewSecond)
    Application.Wait WaitTime
End Sub
Will do what you want when you run the ChangeColors macro.
However, while the macro is running, the user can not do anything with the sheet. Is that a problem?
You could make it so that it went on until they clicked a button or something. Let me know if you want help with that.

>hi all,
>in excel, i want to make my text in a cell, blink in random color
>anyone know.. how to do it ??
>
>thanks in advance,
>
>Budi
___________________________
Kenneth Wonderley
http://www.wonderley.com


...the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness and self-control.
Galatians 5:22 & 23
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform