Tutorial : How to create Analog O'clock with VBA Excel
Hi All..
Meet me again and now I want show you how to create Analog O'clock with VBA Excel and I hope this can be help you to expand on your work.
Ok ladies and gentleman, now step by step begin to our practice.
- Open you microsoft office excel and select the SmartArt icon and choose diagram
- Input on type you text from start 12, 1 to 11 for clock
- Select Shapes and change Shape Fill and Shape Outline to No Fill and No Outline
- Insert 2 line for Horizontal and Vertical line to focus center
- Insert 3 of Circles shapes and make clockwise Second, Minute and Hour and then drag to center
- Remove horizontal and vertical line and then Group the object, change name to each group with Second, Minute and Hour
- Set format No Outline to circles
- Drag groups to shape of diagram clock
- Insert 2 button from Developer menu to Start and Stop analog o'clock
- Key press Alt+F11 and then Insert one Module
Enter the following code :
Sub Button1_Click()
Sheet1.Shapes("SECON").Rotation = X
Sheet1.Shapes("minute").Rotation = X
Sheet1.Shapes("hour").Rotation = X
Range("A1") = TimeValue(Now)
Range("B2") = Hour(Range("A1"))
Range("C2") = Minute(Range("A1"))
Range("D2") = Second(Range("A1"))
X = 0
Do
DoEvents
Range("A1") = TimeValue(Now)
Range("B2") = Hour(Range("A1"))
Range("C2") = Minute(Range("A1"))
Range("D2") = Second(Range("A1"))
DETIK (1)
Sheet1.Shapes("SECON").Rotation = Range("D3") + 6
Sheet1.Shapes("minute").Rotation = Range("C3")
Sheet1.Shapes("hour").Rotation = Range("B7")
Loop Until X = 360
End Sub
Sub Button2_Click()
End
End Sub
Sub DETIK(DET As Double)
xTimer = Timer
Do
DoEvents
Loop Until (Timer - xTimer) >= DET
End Sub
11.Design Fill picture with anything you want, I'm choose my picture Haha.. lol
Now enter formulas on cells as comment show
12.Analog O'clock finish and press Start button
Ok ladies and gentleman so tutorial from me hopefully useful and to meet in my other post, do not forget to vote me and thank you for your visit.
Postingan yang sangat bermanfaat. Saran saya #hastag pertamanya pakek secien.
@arifuddinaba
Terima kasih bg, btw secien itu masuk kemana ya.. Soalnya kurang tau nih..
Sudah saya edit tag ke science bang arie, makasih masukannya. 10 jempol buat bg arie.
Science
Mantaaabbbbb bg... bisa dipake ditangan ga ni? Hihi
Hehehe.. Bisa bg, laptopnya langsung di ikat di tangan hehe
Ahahahaa... ga jd lah.. 😂
Sangat bermanfaat..postingannya bagus
Trm ksh