×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

A Drawing Problem

A Drawing Problem

A Drawing Problem

(OP)
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

RE: A Drawing Problem

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources