Need a book? Engineering books recommendations...

Return to index: [Subject] [Thread] [Date] [Author]

RE: Chart Excel For Engineering Usage

[Subject Prev][Subject Next][Thread Prev][Thread Next]
If you are familiar with Visual Basic, then maybe you can use some of the following Visual Basic code, I wrote a few years ago. It checks the maximum x- and y-values (placed in cells D3:D32 and E3:E32 respectively, in a worksheet named "Polygon", protected with a password "ABC"), and scales the chart in such a manner that the Y-axis scale is 20% larger than the X-axis scale. 
Gunnar Hafsteinn Isleifsson

Sub Auto_Open()
    Application.Calculation = xlAutomatic
    Worksheets("Polygon")._OnCalculate_ = "CheckCells"
End Sub

Sub CheckCells()
    Application.ScreenUpdating = False
    Worksheets("Polygon").Unprotect ("ABC")
    MaxX = Application.Max(Worksheets("Polygon").Range("D3:D32"))
    MaxY = Application.Max(Worksheets("Polygon").Range("E3:E32"))
    X_Axis_Max = Application.Max(MaxX, MaxY / 1.2, 1)
    Y_Axis_Max = 1.2 * X_Axis_Max
    With Worksheets("Polygon").ChartObjects("Chart 1").Chart.Axes(xlCategory)
        .MinimumScale = 0
        .MaximumScale = X_Axis_Max
    End With
    With Worksheets("Polygon").ChartObjects("Chart 1").Chart.Axes(xlValue)
        .MinimumScale = 0
        .MaximumScale = Y_Axis_Max
    End With
    Worksheets("Polygon").Protect password:="ABC"
    Application.ScreenUpdating = True
End Sub
Sub Auto_Close()
  Worksheets("Polygon")._OnCalculate_ = ""
End Sub

From: Szuchuan Chang [mailto:szuchuan(--nospam--at)]
Sent: 14 November 2005 05:25
Subject: Chart Excel For Engineering Usage

I very much like the charting capabilities in MS Excel for engineering purpose.
In one of the applications, I use chart to draw beam/column section with the number of reinforcing bars shown on its locatoin.
I wish that the chart can be like AutoCAD that holds  the X-Y scale to the same scale.
Is that possible?
Sam Chang