# Plot my auto-shapes on a userform

#### bugatti79

##### Board Regular
Folks,

I have created lines and circles using auto shapes and these are placed on a worksheet. The auto-shapes are modifed based on user inputs.

It is working perfectly. All I want to do now is put it on a user form. Any ideas? Below is the code for plotting the shapes
Would an idea to make a picture out of it and copy onto the userform?

Code:
``````Public Sub Plot_Circles()

Dim line1_Beginx As Single, line1_beginy As Single, line1_endx As Single, line1_endy As Single
Dim line2_Beginx As Single, line2_beginy As Single, line2_endx As Single, line2_endy As Single
Dim line3_Beginx As Single, line3_beginy As Single, line3_endx As Single, line3_endy As Single
Dim CD_2 As Single, CD_1 As Single, Theta_c As Single, R_3 As Single, R_2 As Single, R_1 As Single

'Clear Sheets
'Sheet1.Shapes.SelectAll
'Selection.Delete

Range("Q2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-10],RC[-16]:RC[-2],9,TRUE)"
Range("r2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-11],RC[-17]:RC[-3],10,TRUE)"
Range("s2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-12],RC[-18]:RC[-4],11,TRUE)"
Range("t2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-13],RC[-19]:RC[-5],4,TRUE)"
Range("u2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-14],RC[-20]:RC[-6],3,TRUE)"
Range("v2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-15],RC[-21]:RC[-7],2,TRUE)"

CD_2 = Cells(2, 18)
CD_1 = Cells(2, 17)
Theta_c = Cells(2, 19)
R_3 = Cells(2, 20)
R_2 = Cells(2, 21)
R_1 = Cells(2, 22)

'Calculate positions of line vertices for plots

line1_Beginx = 1000
line1_beginy = 1000
line1_endx = 1000 + CD_2
line1_endy = 1000
line2_Beginx = line1_endx - CD_1 * Sin(3.141 * (90 - Theta_c) / 180)
line2_beginy = 1000 - CD_1 * Cos(3.141 * (90 - Theta_c) / 180)
line2_endx = line1_endx
line2_endy = line1_endy
line3_Beginx = line1_Beginx
line3_beginy = line1_beginy
line3_endx = line2_Beginx
line3_endy = line2_beginy

'Plot Gear Train
Sheets("Sheet1").Select
With Selection
.ShapeRange.Fill.Transparency = 1#
.Height = 2 * R_3
.Left = 1000 - .Height / 2
.Width = 2 * R_3
.Top = 1000 - .Width / 2
End With
'R/Cirle
With Selection
.ShapeRange.Fill.Transparency = 1#
.Height = 2 * R_2
.Left = (1000 + CD_2) - .Height / 2
.Width = 2 * R_2
.Top = 1000 - .Width / 2
End With
'Top Circle
With Selection
.ShapeRange.Fill.Transparency = 1#
.Height = 2 * R_1
.Left = (1000 + CD_2 - CD_1 * Sin(3.141 * (90 - Theta_c) / 180)) - .Height / 2
.Width = 2 * R_1
.Top = (1000 - CD_1 * Cos(3.141 * (90 - Theta_c) / 180)) - .Width / 2
End With

End Sub``````

### Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Replies
2
Views
635

### Forum statistics

1,203,453
Messages
6,055,530
Members
444,794
Latest member
HSAL ### 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.

### Which adblocker are you using?    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

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