Dynamic Minimum Axis not show 0

BryantK

New Member
Joined
Sep 1, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm trying to build a line graph in excel where the minimum axis is dynamic and it will show 90% of the minimum value in the data range instead of always defaulting to 0.

I'm fine with how the Maximum axis value is working, but the line chart doesn't look great when the minimum axis value always defaults to 0.

Let me know if this is possible through VBA or other options.

Thanks,
Bryant
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Let's say the data series lies in the range D5:J5 in the active sheet. Change that to suit. Try the following on a copy of your workbook. Getting it to happen automatically is the next step, but we'd need to know how your series values change for that.

VBA Code:
Sub test()
    ActiveSheet.ChartObjects(1).Activate
    With ActiveChart.Axes(xlValue, xlPrimary)
        .MinimumScale = Application.Min(ActiveSheet.Range("D5:J5")) * 0.9
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,733
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top