Blinking Stars Effect for Shapes (VBA)

ybr_15

Board Regular
Joined
May 24, 2016
Messages
194
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
I see a post at Blinking Text In Excel for blinking text. I just wondering how to make blinking stars effect in excel using shapes?. Example, I have 10 stars shape in excel and how to make them blinking like stars (randomly maybe, not in the same time). And I want 1 button to start and 1 button to stop them too. Thank you
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

ybr_15

Board Regular
Joined
May 24, 2016
Messages
194
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Maybe you can get an idea of how from my mini-blog article here...

<!-- title / author block --> A Blinking Christmas Tree
Thanks for your answer, Rick. It's like what I want but I have a question. I want using just 3 colors (RGB color code) for blinking. Can you help me how do that? Thank you very much

Here your code before:
Code:
Dim X As Long, Colors As Variant  Colors = Array(255, 16711680, 16751001, 65535, 52377, 26367)
  Do
    DoEvents
    If Not OnOffToggle Then Exit Sub
    For X = 1 To ActiveSheet.Shapes.Count
      ActiveSheet.Shapes(X).Fill.ForeColor.RGB = CLng(Colors(Int(6 * Rnd)))
    Next
    DoEvents
    Application.Wait Now + TimeSerial(0, 0, 1)
  Loop
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,976
Office Version
  1. 2016
Platform
  1. Windows
I want using just 3 colors (RGB color code) for blinking. Can you help me how do that?
When you say "just 3 colors (RGB color codes)", do you mean the 3 color values RedVal, GreenVal, BlueVal in RGB(RedVal,GreenVal,BlueVal) or do you mean three separate physical colors for the shape's color? If the latter, then what are the actual colors and did you want them randomly assigned?
 
Last edited:

ybr_15

Board Regular
Joined
May 24, 2016
Messages
194
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi Rick, thanks again for your reply. What I mean is this: I have 3 color RGB, they are (237,85,101), (79,193,233), and (160,212,104). How can I implement this code? and can you explain about CLng in your code (why do you use it)? Thank you very much
 

Watch MrExcel Video

Forum statistics

Threads
1,129,754
Messages
5,638,170
Members
417,011
Latest member
Amaden95

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