duck_hunter_82
New Member
- Joined
- Oct 12, 2017
- Messages
- 2
Good Afternoon!
I found the below code in a previous string years ago and plan to use for safety recognition (similar to drawing a name from a hat). However, I know very little about VBA. Can someone please help me identify how to modify this code to have the chart rotate longer? Maybe at minimum 2 rotations before stopping?
Sub RotateWheel02()
Dim spin As Long
Dim i As Long 'loop index
Dim start As Single 'timer start
'get the rotation
Randomize
spin = Application.Ceiling(Int(360 * Rnd + 1), 10) 'multiple of 10
For i = 0 To spin Step 10
'pause for animation effect
start = Timer
Do While Timer < start + 0.1
DoEvents
Loop
'rotate shape
ActiveSheet.ChartObjects("Chart 3").Chart.Rotation = i
Next
End Sub
Thanks,
Chris
I found the below code in a previous string years ago and plan to use for safety recognition (similar to drawing a name from a hat). However, I know very little about VBA. Can someone please help me identify how to modify this code to have the chart rotate longer? Maybe at minimum 2 rotations before stopping?
Sub RotateWheel02()
Dim spin As Long
Dim i As Long 'loop index
Dim start As Single 'timer start
'get the rotation
Randomize
spin = Application.Ceiling(Int(360 * Rnd + 1), 10) 'multiple of 10
For i = 0 To spin Step 10
'pause for animation effect
start = Timer
Do While Timer < start + 0.1
DoEvents
Loop
'rotate shape
ActiveSheet.ChartObjects("Chart 3").Chart.Rotation = i
Next
End Sub
Thanks,
Chris