Consulting

Results 1 to 2 of 2

Thread: Solved: macro to update chart axis

  1. #1
    VBAX Contributor
    Joined
    Jun 2009
    Posts
    110
    Location

    Solved: macro to update chart axis

    Hello

    I have a chart in excel that is used as a timeline. When I start a new task I have to format the X axis on the Chart manually to the dates I choose.

    Can someone help me with a macro that can copy the START and END date from a field in the file and update the chart?

    I tried recording a macro with the same steps, it works initially except that when I changed the dates and ran the macro to update the new dates the X axis did not changed, it kepted the old dates.

    Thanks-
    Attached Files Attached Files

  2. #2
    VBAX Contributor
    Joined
    Jun 2009
    Posts
    110
    Location
    OK. I got it to work nicely while searching the web..

    Thanks to those who viewed my post...

    This is the code..


    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.Axes(xlCategory).Select
    With ActiveChart.Axes(xlCategory)
    .MinimumScale = Range("n1").Value -----' this is where the values are'
    .MaximumScale = Range("n2").Value-----' this is where the values are'
    .MinorUnit = 1
    .MajorUnit = 1
    .Crosses = xlAutomatic
    .ReversePlotOrder = False
    .ScaleType = xlLinear
    .DisplayUnit = xlNone
    End With

Posting Permissions

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