I have the following code to create a bar a point and a pin
![]()
Private Sub CommandButton1_Click() list_top = "AA1" For i = 1 To 100000 shape_type = Range(list_top).Offset(i, 0).Value If shape_type = "" Then Exit Sub Select Case shape_type Case "bar" new_bar Range(list_top).Offset(i, 1).Value, Range(list_top).Offset(i, 2).Value, Range(list_top).Offset(i, 3).Value Case "point" new_point Range(list_top).Offset(i, 1).Value Case "pin" new_pin Range(list_top).Offset(i, 1).Value, Range(list_top).Offset(i, 2).Value End Select Next i End Sub![]()
Public Sub new_bar(ByVal bar_name As String, ByVal bar_width As Double, bar_length_pin_to_pin As Double) ActiveSheet.Shapes("_bar").Duplicate DoEvents ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Name = bar_name ActiveSheet.Shapes(bar_name).Height = bar_width ActiveSheet.Shapes(bar_name).Width = bar_width + bar_length_pin_to_pin End Sub![]()
Public Sub new_point(ByVal point_name As String) ActiveSheet.Shapes("_point").Duplicate DoEvents ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Name = point_name End SubIn Cell AA1 to AD5 i have the following![]()
Public Sub new_pin(ByVal pin_name As String, ByVal statonary As Double) ActiveSheet.Shapes("_pin").Duplicate DoEvents ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Name = pin_name ActiveSheet.Shapes(pin_name).Width = pin_diameter End Sub
Type Name
bar __bar_2 20 120
bar __bar_1 10 100
point __point_1
pin __pin_1 10
A pin, bar and point are created with a width, height and diameter of the inputted values.
I now what to have another button that positions these newly created shapes
so in cell AI1 to AO5 I have
where row 3 and 4 are the top and left coordinates
Type Name
bar __bar_1 100 100
bar __bar_2 200 200
point __point 200 200
pin __pin 100 100 100
any idea what the best way of doing this would be?
cheers











LinkBack URL
About LinkBacks
Register To Reply


Bookmarks