Clockface and angles

hemsleysut

Board Regular
Joined
Jul 29, 2002
Messages
124
I'd like to design a clockface with an hour and minute hands and the user can move the hands and the angle between them is returned eg 3 o'clock would return 45degrees. Any ideas how to proceed.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hello,

Very interesting question.

Have got code working out the angle of two lines but I can't seem to get it above 90 degrees, will have a look on Moday as I am about to go home now.


Code:
Sub Macro4()
ActiveSheet.Shapes("Line 2").Select
HOR = Selection.ShapeRange.Item("Line 2").Width
VER = Selection.ShapeRange.Item("Line 2").Height
If HOR = 0 Then
    SECOND_ANGLE = 0
Else
If VER = 0 Then
    SECOND_ANGLE = 90
Else
    SECOND_ANGLE = Atn(VER / HOR) * 180 / 3.1415927
End If
End If

ActiveSheet.Shapes("Line 1").Select
H_VER = Selection.ShapeRange.Item("Line 1").Width
H_HOR = Selection.ShapeRange.Item("Line 1").Height
If H_HOR = 0 Then
    HOUR_ANGLE = 0
Else
If H_VER = 0 Then
    HOUR_ANGLE = 90
Else
    HOUR_ANGLE = Atn(VER / HOR) * 180 / 3.1415927
End If
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,185
Members
449,071
Latest member
cdnMech

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
Back
Top