Macro to change isoceles triangle??!?

Ozzieextreme

New Member
Joined
May 10, 2010
Messages
46
Afternoon all, hope you are well...

I'm wondering if it is possible to have a macro that can automatically alter the shape of an isoceles triangle in Excel based on user inputs...

e.g. if data in cells corresponds to the sides and angles of the triangle, then when the macro is run, the triangle is drawn to match... Hope this makes sense!?

Basically I want to make a macro change a triangle from this... (see below):
triangle2o.jpg

To this... (See below):
triangle1.jpg

Please also note that this is NOT a flipped image, and that this triangle has different internal angles and side lengths to the previous one...

If there's some sort of code that can alter shapes in excel, that would be ace!!

Sorry for the long thread and HUGE triangles!

Any help would be really appreciated!

Cheers guys!

Oz
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi, Draw your Triangle with the first code then adjust angle by changing Angle ( 0 to 90) in cell "A2" and running second code.
NB:- Change "Autoshape" name in second code to match your triangle name.
Alter details tio suit.
Code:
Private Sub CommandButton3_Click()
 ActiveSheet.Shapes.AddShape(msoShapeIsoscelesTriangle, 50, 100#, 200, 140#).Select
End Sub
Code:
Private Sub CommandButton4_Click()
Dim angle As Integer, n
angle = [a2]
n = Tan(angle * Application.Pi() / 180) / 2
ActiveSheet.Shapes("Autoshape 85").Adjustments.Item(1) = n
End Sub
Mick
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

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