Consulting

Results 1 to 2 of 2

Thread: How to assign Xaxis limits to multiple scatter plots on the same sheet?

  1. #1

    How to assign Xaxis limits to multiple scatter plots on the same sheet?

    I have ten scatter plots on the same worksheet tab named Multiples. The charts will all have the same x-axis limits. I want to set the limits with VBA. The x-axis limits are in calculated variables named vXaxisL and vXaxisU.

    I don't know how to address each chart from VBA nor how to assign the limits to the individual charts.

    Office Professional 2016 Excel/VBA. Windows 10

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Dim ws As Worksheet
    Dim cho As ChartObject
    Dim aX As Axis
        
    Set ws = ActiveSheet
    For Each cho In ws.ChartObjects
        Set aX = cho.Chart.Axes(xlCategory)
        aX.MinimumScale = vXaxisL
        aX.MaximumScale = vXaxisU
    Next

Tags for this Thread

Posting Permissions

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