ANIMATED TEXT

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
This is a macro I found on this board.
The text goes from the left to the right.
How can I change this macro,so that the text goes from the right to the left?

Dim myText As String
Dim x As Integer, y As Integer
Dim myStart, myDelay
myText = " ........."
On Error GoTo myEnd
For y = 1 To 10
For x = 1 To 125
myStart = Timer
myDelay = myStart + 0.1
Do While Timer < myDelay
[N4] = Space(x) & myText
DoEvents
Loop
DoEvents
myStart = Timer
myDelay = myStart + 0.1
Next x
Next y
[N4] = ".................. "
myEnd:
End
An idea?Thanks
--------------------------------------------------------------------------------

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 3
End Sub

y idea?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Mudface

MrExcel MVP
Joined
Feb 18, 2002
Messages
3,339
This do?

Code:
Dim myText As String
Dim x As Integer, y As Integer
Dim myStart, myDelay
myText = " ........."
On Error GoTo myEnd
For y = 1 To 10
For x = 125 To 1 Step -1
myStart = Timer
myDelay = myStart + 0.1
Do While Timer < myDelay
[N4] = Space(x) & myText
DoEvents
Loop
DoEvents
myStart = Timer
myDelay = myStart + 0.1
Next x
Next y
[N4] = ".................. "
myEnd:
End
 

Colo

MrExcel MVP,
Joined
Mar 20, 2002
Messages
1,456
Hi verluc,
Only I did is
1.Add "[N4].HorizontalAlignment = xlRight" to the code
2.Amend "[N4] = myText & Space(x)"

:biggrin:

<PRE>
<FONT color=red>Sub </FONT>test2()

<FONT color=red>Dim </FONT>myText <FONT color=red>As</FONT><FONT color=red> String</FONT>

<FONT color=red>Dim </FONT>x <FONT color=red>As</FONT><FONT color=red> Integer</FONT>, y <FONT color=red>As</FONT><FONT color=red> Integer</FONT>

<FONT color=red>Dim </FONT>myStart, myDelay

myText = " ........."

<FONT color=red>On Error</FONT> <FONT color=red>GoTo</FONT> myEnd

<FONT color=red>For </FONT>y = 1 <FONT color=red>To </FONT>10

<FONT color=red>For </FONT>x = 1 <FONT color=red>To </FONT>125

myStart = Timer

myDelay = myStart + 0.1

[N4].HorizontalAlignment = xlRight

<FONT color=red>Do </FONT>While Timer < myDelay

[N4] = myText & Space(x)

DoEvents

<FONT color=red>Loop</FONT>

DoEvents

myStart = Timer

myDelay = myStart + 0.1

<FONT color=red>Next </FONT>x

<FONT color=red>Next </FONT>y

[N4] = ".................. "

myEnd:

<FONT color=red>End Sub</FONT>
</PRE>
 

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
On 2002-09-06 02:28, Colo wrote:
Hi verluc,
Only I did is
1.Add "[N4].HorizontalAlignment = xlRight" to the code
2.Amend "[N4] = myText & Space(x)"

:biggrin:

<PRE>
<FONT color=red>Sub </FONT>test2()

<FONT color=red>Dim </FONT>myText <FONT color=red>As</FONT><FONT color=red> String</FONT>

<FONT color=red>Dim </FONT>x <FONT color=red>As</FONT><FONT color=red> Integer</FONT>, y <FONT color=red>As</FONT><FONT color=red> Integer</FONT>

<FONT color=red>Dim </FONT>myStart, myDelay

myText = " ........."

<FONT color=red>On Error</FONT> <FONT color=red>GoTo</FONT> myEnd

<FONT color=red>For </FONT>y = 1 <FONT color=red>To </FONT>10

<FONT color=red>For </FONT>x = 1 <FONT color=red>To </FONT>125

myStart = Timer

myDelay = myStart + 0.1

[N4].HorizontalAlignment = xlRight

<FONT color=red>Do </FONT>While Timer < myDelay

[N4] = myText & Space(x)

DoEvents

<FONT color=red>Loop</FONT>

DoEvents

myStart = Timer

myDelay = myStart + 0.1

<FONT color=red>Next </FONT>x

<FONT color=red>Next </FONT>y

[N4] = ".................. "

myEnd:

<FONT color=red>End Sub</FONT>
</PRE>
Thanks Colo,

I'll send you via e-mail my excel program.
Can you give any comments on this via this board.
Many thanks
 

inarbeth

Well-known Member
Joined
Apr 8, 2002
Messages
912

ADVERTISEMENT

Help!#@#! How do you get the text to stop? I loaded this but there is no way to exit short of amending the code or closing down. It's like the Sorcerer's Apprentice.
What is the code please to auto run this on the relevant sheet being viewed and to make it run only once or twice? What I have in mind is creating a message for users to see when they access the sheet.
 

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
On 2002-09-06 05:01, inarbeth wrote:
Help!#@#! How do you get the text to stop? I loaded this but there is no way to exit short of amending the code or closing down. It's like the Sorcerer's Apprentice.
What is the code please to auto run this on the relevant sheet being viewed and to make it run only once or twice? What I have in mind is creating a message for users to see when they access the sheet.
Hi,

Here is the code you can use and it is to place in "This workbook".
It run twice.
That's what you want?
Sub Workbook_Open()
Sheets("Sheets1").Select
Dim myText As String
Dim x As Integer, y As Integer
Dim myStart, myDelay
myText = " Good morning to all !!! "
On Error GoTo myEnd
For y = 1 To 2
For x = 50 To 1 Step -1
myStart = Timer
myDelay = myStart + 0.1
Do While Timer < myDelay
[B4] = Space(x) & myText
DoEvents
Loop
DoEvents
myStart = Timer
myDelay = myStart + 0.1
Next x
Next y
[B4] = "Have a good day !!! "
myEnd:
End
End Sub
 

Jim North

MrExcel MVP
Joined
Jun 20, 2002
Messages
791

ADVERTISEMENT

verluc,

What are you using this for?

(just curious)
 

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
On 2002-09-06 07:57, Jim North wrote:
verluc,

What are you using this for?

(just curious)
Hi,

I use this in an excelsheet,for a football
championsleague.This animated text is filled with the publicity of the sponsor.
Any other suggestion to use it?
 

Parra

Well-known Member
Joined
Feb 21, 2002
Messages
752
Nice Macro,

I would use it to highlight significant points of financial reports. Something like "125% to Goal This Quarter".

Thanks
 

inarbeth

Well-known Member
Joined
Apr 8, 2002
Messages
912
On 2002-09-06 07:36, verluc wrote:
Hi,

Here is the code you can use and it is to place in "This workbook".
It run twice.
That's what you want?
Sub Workbook_Open()
Sheets("Sheets1").Select
Dim myText As String
Dim x As Integer, y As Integer
Dim myStart, myDelay
myText = " Good morning to all !!! "
On Error GoTo myEnd
For y = 1 To 2
For x = 50 To 1 Step -1
myStart = Timer
myDelay = myStart + 0.1
Do While Timer < myDelay
[B4] = Space(x) & myText
DoEvents
Loop
DoEvents
myStart = Timer
myDelay = myStart + 0.1
Next x
Next y
[B4] = "Have a good day !!! "
myEnd:
End
End Sub


Thanks. Slight change to syntax required: Sheets(Sheet1) rather than Sheets1. I will omit the B4 entry to avoid overwriting what was in it previously but a neat example.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,112
Messages
5,640,174
Members
417,130
Latest member
Darion2021

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top