Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default looping at regular interval


I am trying to create a "marquee" effect by looping through 3 fill
effects.

It does what I'm going after, but only performs the fill effects once,
then stops. I am trying to get it to repeat from the beginning after
the 3rd fill effect.


Code:
--------------------
Dim iCount As Integer
Sub ColorChange()
Dim dTime As Date
dTime = Now
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange"
iCount = iCount + 1
If iCount = 1 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 2 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 3 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 13
End If
If iCount = 3 Then
iCount = 0
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange", , False
End If
End Sub
--------------------


Thank you in advance


--
grime
------------------------------------------------------------------------
grime's Profile: http://www.excelforum.com/member.php...o&userid=19227
View this thread: http://www.excelforum.com/showthread...hreadid=504978

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default looping at regular interval

remove the line that cancels the Ontime (move it to another routine). Make
dtime a public variable or you won't be able to stop it without closing
Excel.

--
Regards,
Tom Ogilvy


"grime" wrote in
message ...

I am trying to create a "marquee" effect by looping through 3 fill
effects.

It does what I'm going after, but only performs the fill effects once,
then stops. I am trying to get it to repeat from the beginning after
the 3rd fill effect.


Code:
--------------------
Dim iCount As Integer
Sub ColorChange()
Dim dTime As Date
dTime = Now
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange"
iCount = iCount + 1
If iCount = 1 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 2 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 3 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 13
End If
If iCount = 3 Then
iCount = 0
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange", , False
End If
End Sub
--------------------


Thank you in advance


--
grime
------------------------------------------------------------------------
grime's Profile:

http://www.excelforum.com/member.php...o&userid=19227
View this thread: http://www.excelforum.com/showthread...hreadid=504978



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default looping at regular interval


I'm fairly new to the VBA thing. Can you explain that?

Tom Ogilvy Wrote:
remove the line that cancels the Ontime (move it to another routine).
Make
dtime a public variable or you won't be able to stop it without
closing
Excel.

--
Regards,
Tom Ogilvy


"grime" wrote in
message ...

I am trying to create a "marquee" effect by looping through 3 fill
effects.

It does what I'm going after, but only performs the fill effects

once,
then stops. I am trying to get it to repeat from the beginning

after
the 3rd fill effect.


Code:
--------------------
Dim iCount As Integer
Sub ColorChange()
Dim dTime As Date
dTime = Now
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange"
iCount = iCount + 1
If iCount = 1 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 2 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 3 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 13
End If
If iCount = 3 Then
iCount = 0
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange", ,

False
End If
End Sub
--------------------


Thank you in advance


--
grime

------------------------------------------------------------------------
grime's Profile:

http://www.excelforum.com/member.php...o&userid=19227
View this thread:

http://www.excelforum.com/showthread...hreadid=504978



--
grime
------------------------------------------------------------------------
grime's Profile: http://www.excelforum.com/member.php...o&userid=19227
View this thread: http://www.excelforum.com/showthread...hreadid=504978

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default looping at regular interval

Dim iCount As Integer
Dim dTime as Date
Sub ColorChange()
dTime = Now
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange"
iCount = iCount + 1
If iCount = 1 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 2 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 3 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 13
End If
If iCount = 3 Then
iCount = 0
End If
End Sub

Sub StopAnimation()
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange", , False
End Sub

--
Regards,
Tom Ogilvy


"grime" wrote in
message ...

I'm fairly new to the VBA thing. Can you explain that?

Tom Ogilvy Wrote:
remove the line that cancels the Ontime (move it to another routine).
Make
dtime a public variable or you won't be able to stop it without
closing
Excel.

--
Regards,
Tom Ogilvy


"grime" wrote in
message ...

I am trying to create a "marquee" effect by looping through 3 fill
effects.

It does what I'm going after, but only performs the fill effects

once,
then stops. I am trying to get it to repeat from the beginning

after
the 3rd fill effect.


Code:
--------------------
Dim iCount As Integer
Sub ColorChange()
Dim dTime As Date
dTime = Now
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange"
iCount = iCount + 1
If iCount = 1 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 2 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 13
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 8
End If
If iCount = 3 Then
ActiveSheet.Shapes("Group 1").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 2").Fill.ForeColor.SchemeColor = 8
ActiveSheet.Shapes("Group 3").Fill.ForeColor.SchemeColor = 13
End If
If iCount = 3 Then
iCount = 0
Application.OnTime dTime + TimeValue("00:00:01"), "ColorChange", ,

False
End If
End Sub
--------------------


Thank you in advance


--
grime

------------------------------------------------------------------------
grime's Profile:

http://www.excelforum.com/member.php...o&userid=19227
View this thread:

http://www.excelforum.com/showthread...hreadid=504978



--
grime
------------------------------------------------------------------------
grime's Profile:

http://www.excelforum.com/member.php...o&userid=19227
View this thread: http://www.excelforum.com/showthread...hreadid=504978



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to select non-adjacent cells with regular interval rickhoff Excel Discussion (Misc queries) 3 June 10th 13 10:18 AM
Look-up a value within an interval Christine Excel Worksheet Functions 12 September 26th 08 06:14 PM
how i create a interval demetrio29 Excel Discussion (Misc queries) 3 September 23rd 08 10:50 PM
interval formula xposedphotography Excel Discussion (Misc queries) 1 April 6th 08 05:51 PM
Sum.if date is in an interval... Mikael Lindqvist Excel Worksheet Functions 6 November 13th 07 10:06 AM


All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"