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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
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,187,178
Messages
5,962,051
Members
438,578
Latest member
MrJimC

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