Tutorial : How to create Analog O'clock with VBA Excel

in #education7 years ago (edited)

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.

  1. Open you microsoft office excel and select the SmartArt icon and choose diagram
    1.PNG
  2. Input on type you text from start 12, 1 to 11 for clock
    2.PNG
  3. Select Shapes and change Shape Fill and Shape Outline to No Fill and No Outline
    3.PNG
    4.PNG
  4. Insert 2 line for Horizontal and Vertical line to focus center
    6.PNG
  5. Insert 3 of Circles shapes and make clockwise Second, Minute and Hour and then drag to center
    7.PNG
    8.PNG
  6. Remove horizontal and vertical line and then Group the object, change name to each group with Second, Minute and Hour
    9.PNG
  7. Set format No Outline to circles
    10.PNG
  8. Drag groups to shape of diagram clock
    11.PNG
  9. Insert 2 button from Developer menu to Start and Stop analog o'clock
    12.PNG
  10. 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
13.PNG
11.Design Fill picture with anything you want, I'm choose my picture Haha.. lol
Now enter formulas on cells as comment show
14.PNG
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.

Sort:  

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.

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

Coin Marketplace

STEEM 0.21
TRX 0.25
JST 0.038
BTC 97111.20
ETH 3382.29
USDT 1.00
SBD 3.20