Thread: excel and fun?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default excel and fun?

1.You could try singing along to this if you know the tune. Movement
is not all that smooth or steady and depending on the speed of your
machine you might have to adjust the end value in the For Next loop...

For I = 1 To 3000
DoEvents
Next I

make the 3000 larger to slow the scrolling or smaller to speed up.

Public Sub ScrollStatus()
Dim strMsg As String
Dim strSubMsgs(1 To 13) As String
Dim strDisplayMsg As String
Dim OldStatusBar
Dim K As Long, I As Long
OldStatusBar = Application.StatusBar
strSubMsgs(1) = " "
strSubMsgs(2) = "When there's a shine on your shoes, "
strSubMsgs(3) = "there's a melody in your heart, "
strSubMsgs(4) = "with a singable happy feeling, "
strSubMsgs(5) = "a wonderful way to start. "
strSubMsgs(6) = "You'll find the world every day "
strSubMsgs(7) = "with a deedle dum dee di di, "
strSubMsgs(8) = "with a melody that is making "
strSubMsgs(9) = "the worrying world go by. "
strSubMsgs(10) = "When you walk down the street "
strSubMsgs(11) = "with a happy-go-lucky beat, "
strSubMsgs(12) = "you'll find a lot in what I'm repeating. "
strSubMsgs(13) = "what a wonderful way to start the day."
For I = 1 To 12
strMsg = strMsg & strSubMsgs(I)
Next I
For I = 2 To 3
strMsg = strMsg & strSubMsgs(I)
Next I
strMsg = strMsg & strSubMsgs(13)

Do While K <= Len(strMsg)
K = K + 1
strDisplayMsg = Mid(strMsg, K, 150)
Application.StatusBar = strDisplayMsg
For I = 1 To 3000
DoEvents
Next I
Loop
Application.StatusBar = OldStatusBar
End Sub

2. You could draw the SmileyFace AutoShape twice and adjust the mouth
to be happy on one and sad on the other. Select the happy one then
click in the Name Box on the left of the Formula Bar, type in Happy
then press Enter. Repeat for the Sad one but type in Sad. Position
them both near the the cell (A1 in my code) holding the value that is
hopefully going to achieve the Target value (100 in my code). If they
are identical size and shape and perfectly overlapping it will look
like the one face with a changing smile.

Then copy the following code, right click the sheet tab, choose "View
code" and paste it into the sheet code module. The code runs every
time the worksheet calculates. When A1 is greater than or equal to 100
the Happy face is visible while the Sad face is hidden, and vice versa
when A1 is less than the Target value of 100.

Private Sub Worksheet_Calculate()
Const TargetValue As Single = 100
If Range("A1").Value < TargetValue Then
Me.Shapes("Sad").Visible = True
Me.Shapes("Happy").Visible = False
Else: Me.Shapes("Sad").Visible = False
Me.Shapes("Happy").Visible = True
End If
End Sub

Ken Johnson