+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    10-28-2009
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    30

    Set graph type (log/linear) according to radio button

    Hi,

    I have an excel with a chart in it.
    I would like to change the Y scale of the chart from logarithmic to linear and vise versa according to 2radio buttons I have in the same sheet.
    is it possible? if yes, how? if not, maybe you have any other idea how to change it user friendly?

    xsl attached.

    thanks.
    Attached Files Attached Files
    Last edited by michael.g; 11-07-2009 at 04:12 PM.

  2. #2
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Set graph type (log/linear) according to radio button

    Inset these 2 macros into a module and assign them to your radio buttons.

    These will allow you to switch between Log and Linear Scales

    Code:
    Sub Log()
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.Axes(xlValue).Select
        With ActiveChart.Axes(xlValue)
            .MinimumScaleIsAuto = True
            .MaximumScaleIsAuto = True
            .MinorUnitIsAuto = True
            .MajorUnitIsAuto = True
            .Crosses = xlAutomatic
            .ReversePlotOrder = False
            .ScaleType = xlLogarithmic
            .DisplayUnit = xlNone
        End With
    End Sub
    Code:
    Sub lin()
        With ActiveChart.Axes(xlValue)
            .MinimumScaleIsAuto = True
            .MaximumScaleIsAuto = True
            .MinorUnitIsAuto = True
            .MajorUnitIsAuto = True
            .Crosses = xlAutomatic
            .ReversePlotOrder = False
            .ScaleType = xlLinear
            .DisplayUnit = xlNone
        End With
    End Sub
    Last edited by jj72uk; 11-05-2009 at 01:01 PM.

  3. #3
    Registered User
    Join Date
    10-28-2009
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Set graph type (log/linear) according to radio button

    Thanks!!!!!!!!!!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0