Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Drawing Problem

Status
Not open for further replies.

Trentoes

Mechanical
Oct 22, 2007
1
Hey guys,
I'm currently undertaking a project where I have to use VBE for Excel (which I'm not too familiar with). So the problem is... I've created a box (just a normal rectangle) for a graph and I have to draw scaled tick on... ie. marks for the axis' every increment. This is the suggested form...

Private Sub DrawScales()
If the distance increment is greater than zero Then
DrawDistScale distincrement
End If

If the elevation increment is greater than zero Then
DrawElevScale elevincrement
End If
End Sub

Does anyone know how to do this? I've attached the excel file so you can see what's going on... Just scroll down to the above section... Your help is greatly appreciated! Cheers,
Trent
 
Replies continue below

Recommended for you

Try this

Private Sub DrawScales()

dblDistTick = frmProfile.txtDistTick.Value
dblElevTick = frmProfile.txtElevTick.Value
Dim dclicks
Dim eclicks
Dim counter
Dim yloc
dclicks = (frmProfile.txtDistMax.Value - frmProfile.txtDistMin.Value) / frmProfile.txtDistTick

yloc = MARGIN_TOP + PROF_HEIGHT
If dclicks > 1 Then

For counter = 1 To Application.WorksheetFunction.RoundUp(dclicks, 0)
If counter * frmProfile.txtDistTick * xScale <= PROF_WIDTH Then
With ActiveSheet.Shapes.BuildFreeform(msoEditingAuto, MARGIN_LEFT + counter * frmProfile.txtDistTick * xScale, yloc)
.AddNodes msoSegmentLine, msoEditingAuto, MARGIN_LEFT + counter * frmProfile.txtDistTick * xScale, yloc + 10
.ConvertToShape.Select
End With
Selection.ShapeRange.Line.Weight = 1.75
End If
Next counter

End If

If dblElevTick > 0 Then
' Please insert subprogram here
End If
End Sub

For your distance ticks. You can use the same type of code for the y ticks.

How come you are not using a chart?

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top