problem with a chart

daniboymu

Board Regular
Joined
Nov 1, 2020
Messages
54
Office Version
  1. 2019
Platform
  1. Windows
I am having a problem when I try to rescale my chart
my chart uses hour time as the X-axis and residual as Y-axis
when I work with days on the X-axis it works fine but I also need to work with hour
1618944691892.png

above its the chart which I want to keep but sometimes I need to change the period and then I need to rescale the chart but when I rescale it and then this happens
1618944770382.png

what should I do?

here is the VBA code to rescale the chart
VBA Code:
Sub EscalaAtivos1()

    Dim nome As String
  
    Application.ScreenUpdating = False
  
    ActiveSheet.ChartObjects("Chart 5").Activate
  
    ActiveChart.Axes(xlValue, 1).Select
  
    With ActiveChart.Axes(xlValue, 1)
        .Crosses = xlMinimum - 0.1
        .MinimumScale = Range("I6").Value
        .MaximumScale = Range("H6").Value
        .MajorUnit = Range("J4")
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
  
    ActiveChart.Axes(xlCategory, 1).Select
    
    With ActiveChart.Axes(xlCategory, 1)
        '.Crosses = xlMinimum
        .CategoryType = xlTimeScale
        .MajorUnit = Range("J6").Value
        '.BaseUnitIsAuto = True
        .MinimumScale = Range("H4").Value
        .MaximumScale = Range("I4").Value
        .TickLabels.Orientation = 45
        .ReversePlotOrder = False
 
end sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,215,053
Messages
6,122,888
Members
449,097
Latest member
dbomb1414

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