• ChatGPT Business
  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
    • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips

No products in the cart.

  • ChatGPT Business
  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
    • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips

No products in the cart.

  • ChatGPT Business
  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
    • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips

No products in the cart.

  • ChatGPT Business
  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
    • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
Excel

How to automatically adjust chart axis scaling in Excel

0 Comments

How to automatically adjust chart axis scaling in Excel. Creating a chart in Excel is very simple, but dividing the X and Y axis scaling symmetrically and aesthetically is still a problem for many Excel users. In this article, UniTrain will guide you through two automatic methods to adjust chart axis scaling in Excel: 1. Using the Format Axis feature in Excel 2. Running VBA code in Excel

1. Using the Format Axis feature to change adjust chart axis scaling in Excel

To automatically change the chart axis by using the Format Axis feature in Excel, follow these steps:

Step 1: Create data for the X and Y axes (as shown below).

How to automatically adjust chart axis scaling in Excel

How to automatically adjust chart axis scaling in Excel

Step 2: Insert a 2-D column chart by selecting cell B4 > Insert > selecting the chart icon and inserting a column chart (as shown below).

How to automatically adjust chart axis scaling in Excel

How to automatically adjust chart axis scaling in Excel

Then, the column chart will be displayed as shown below:

How to automatically adjust chart axis scaling in Excel

How to automatically adjust chart axis scaling in Excel

Step 3: Right-click and select Format Axis.

How to automatically adjust chart axis scaling in Excel

How to automatically adjust chart axis scaling in Excel

Then, select Axis option > Units > change it to 3000.

How to automatically adjust chart axis scaling in Excel

How to automatically adjust chart axis scaling in Excel

You will see that Maximum Bounds will automatically change from 20000 to 21000, and the unit of the Y-axis will change from 2000 to 3000 as shown below:

How to automatically adjust chart axis scaling in Excel

How to automatically adjust chart axis scaling in Excel

However, for the X-axis, users cannot change the scaling because they are using text instead of values. That’s why users keep the chart’s horizontal data unchanged. Right-click > select Format Axis > select Automatically select based on data in the Axis Type section and Automatic in the Vertical axis crosses section.

adjust chart axis scaling 72. Run Excel VBA code to automatically change chart axis scale

Procedure: Step 1: Select Developer > Visual Basic.

adjust chart axis scaling 8When the Microsoft Visual Basic for Applications window appears, select Insert > Module.

adjust chart axis scaling 9Step 2: Insert the code below into the Module.

Function ChartAxisScale(sheetName As String, chartName As String, MinOrMax As String, _
ValueOrCategory As String, PrimaryOrSecondary As String, Value As Variant)
Dim chart As chart
Dim text As String
‘Set the function to control the chart
Set chart = Application.Caller.Parent.Parent.Sheets(sheetName) _
.ChartObjects(chartName).chart
‘Set Primary axis Value
If (ValueOrCategory = “Value” Or ValueOrCategory = “Y”) _
And PrimaryOrSecondary = “Primary” Then
With chart.Axes(xlValue, xlPrimary)
If IsNumeric(Value) = True Then
If MinOrMax = “Max” Then .MaximumScale = Value
If MinOrMax = “Min” Then .MinimumScale = Value
Else
If MinOrMax = “Max” Then .MaximumScaleIsAuto = True
If MinOrMax = “Min” Then .MinimumScaleIsAuto = True
End If
End With
End If
‘Set Primary axis Category
If (ValueOrCategory = “Category” Or ValueOrCategory = “X”) _
And PrimaryOrSecondary = “Primary” Then
With chart.Axes(xlCategory, xlPrimary)
If IsNumeric(Value) = True Then
If MinOrMax = “Max” Then .MaximumScale = Value
If MinOrMax = “Min” Then .MinimumScale = Value
Else
If MinOrMax = “Max” Then .MaximumScaleIsAuto = True
If MinOrMax = “Min” Then .MinimumScaleIsAuto = True
End If
End With
End If
‘Set secondary axis value
If (ValueOrCategory = “Value” Or ValueOrCategory = “Y”) _
And PrimaryOrSecondary = “Secondary” Then
With chart.Axes(xlValue, xlSecondary)
If IsNumeric(Value) = True Then
If MinOrMax = “Max” Then .MaximumScale = Value
If MinOrMax = “Min” Then .MinimumScale = Value
Else
If MinOrMax = “Max” Then .MaximumScaleIsAuto = True
If MinOrMax = “Min” Then .MinimumScaleIsAuto = True
End If
End With
End If
‘Set secondary axis category
If (ValueOrCategory = “Category” Or ValueOrCategory = “X”) _
And PrimaryOrSecondary = “Secondary” Then
With chart.Axes(xlCategory, xlSecondary)
If IsNumeric(Value) = True Then
If MinOrMax = “Max” Then .MaximumScale = Value
If MinOrMax = “Min” Then .MinimumScale = Value
Else
If MinOrMax = “Max” Then .MaximumScaleIsAuto = True
If MinOrMax = “Min” Then .MinimumScaleIsAuto = True
End If
End With
End If
If IsNumeric(Value) Then text = Value Else text = “Auto”
ChartAxisScale = ValueOrCategory & ” ” & PrimaryOrSecondary & ” ” _
& MinOrMax & “: ” & text
End Function
Sub Axis_Scale()
End Sub

adjust chart axis scaling 10Then, select Run > Run Sub/UserForm.

adjust chart axis scaling 11
After running the VBA code, you can create a user-defined function.
Then, go back to the Excel worksheet, select cell B20 and enter: =ChartAxisScale(“Sheet1″,”Chart 2″,”Max”,”Value”,”Primary”,C19)

adjust chart axis scaling 12

Rate this post
44
306 Views
Moving a window to another screen on Windows 10PrevMoving a window to another screen on Windows 10March 27, 2023
How to Change Default Browser in Windows 10March 27, 2023How to Change Default Browser in Windows 10Next

Leave a Reply Cancel reply

You must be logged in to post a comment.

Buy Windows 11 Professional MS Products CD Key
Buy Office 2021 Professional Plus Key Global For 5 PC
Top rated products
  • Avast Premium Security 2021 Avast Premium Security 2021 1 Device 1 Year Global
    Rated 5.00 out of 5
    $11.00
  • Trend Micro Internet Security 3 Devices 1 Year Key GLOBAL Trend Micro Internet Security 3 Devices 1 Year Key GLOBAL
    Rated 5.00 out of 5
    $17.00
  • Windows 11 Pro Key Global Windows 11 Pro Key Global
    Rated 5.00 out of 5
    $6.00
  • AVG Internet Security 2021 10 Devices 2 Years Global AVG Internet Security 2021 10 Devices 2 Years Global
    Rated 5.00 out of 5
    $42.20
  • Trend Micro Maximum Security 3 Devices 1 Year key Global Trend Micro Maximum Security 3 Devices 1 Year key Global
    Rated 5.00 out of 5
    $15.00
Products
  • Windows 10 Education Key Global Windows 10 Education Key Global
    Rated 4.84 out of 5
    $9.00
  • Microsoft Visio Professional 2013 Key 1PC Microsoft Visio Professional 2013 Key 1PC $9.00
  • ChatGPT Business – 1 Month of Affordable Power with ChatGPT 5 & ChatGPT 5 Pro ChatGPT Business – 1 Month of Affordable Power with ChatGPT 5 & ChatGPT 5 Pro $34.00 Original price was: $34.00.$9.00Current price is: $9.00.
  • Kaspersky Premium - 1 Device 1 Year - GLOBAL Kaspersky Premium - 1 Device 1 Year - GLOBAL $37.00
  • microsoft office home and business 2019 pcmac key Microsoft Office Home And Business 2019 (MAC) key bind to your Microsoft account
    Rated 4.95 out of 5
    $30.00
  • Windows 10 Enterprise LTSC 2019 Key Global Windows 10 Enterprise LTSC 2019 Key Global
    Rated 4.83 out of 5
    $9.00
  • Windows Server 2022 Remote Desktop Services User Connections (50) Cal Key Global Windows Server 2022 Remote Desktop Services User Connections (50) Cal Key Global
    Rated 5.00 out of 5
    $22.00
  • SQL Server 2014 Standard SQL Server 2014 Standard $20.00
  • AVG Internet Security 2021 1 Device 1 Year Global AVG Internet Security 2021 1 Device 1 Year Global
    Rated 5.00 out of 5
    $11.00
  • Microsoft Visual Studio Enterprise 2019 For 1 PC Microsoft Visual Studio Enterprise 2019 For 1 PC
    Rated 4.88 out of 5
    $15.00
Product categories
  • Anti Virus
  • Microsoft Office
  • Microsoft Project
  • Microsoft Visio
  • Microsoft Visual
  • Microsoft Windows
  • Other Software
  • Uncategorized

Buffcom.net always brings the best digital products and services to you. Specializing in Office Software and online marketing services

BIG SALE 50% IN MAY

Microsoft Office
Microsoft Windows
Anti-Virus
Contact Us

Visit Us:

125 Division St, New York, NY 10002, USA

Mail Us:

buffcom.net@gmail.com

TERMS & CONDITIONS | PAYMENT GUIDE  | SHIPPING POLICY  | REFUND POLICY

Copyright © 2019 buffcom.net  All Rights Reserved.