在条形图上为x轴创build恒定的标签

初学者问题在这里。 我有一部分vba脚本需要数据(取决于用户以前的input),并返回特定于所讨论数据的条形图。 我正在寻找如何增加下面的代码,以提供一个恒定的x轴标签结构。 我总是希望最小值为0,最大值为5.现在,我正在根据返回的数据获得定制的x轴标签。

其中一些可能是混乱的混乱,并寻找任何方法来使这更高效或优雅。 谢谢。

'CREATE CHART WITH CURRENT Dim chart_1 As Chart 'Chart If Cells(16, 4).Value = "Data Not Available" Then Range("A1").Select Else Set chart_1 = Charts.Add Set chart_1 = chart_1.Location(Where:=xlLocationAsObject, Name:="LMC_Model") 'with statement to expedite typing With chart_1 .HasTitle = True .ChartTitle.Text = scenario & " Scores for " & risk .ChartType = xlColumnClustered 'if statement to get correct data for x-axis If scenario = current Then .SetSourceData Source:=ThisWorkbook.Worksheets(riskLookupScore).Range("a2:a11, b2:b11"), PlotBy:=xlRows ElseIf scenario = shortTerm Then .SetSourceData Source:=ThisWorkbook.Worksheets(riskLookupScore).Range("a2:a11, c2:c11"), PlotBy:=xlRows ElseIf scenario = longTerm Then .SetSourceData Source:=ThisWorkbook.Worksheets(riskLookupScore).Range("a2:a11, d2:d11"), PlotBy:=xlRows End If With .Parent .Height = 315 .Width = 440 .Top = Range("b26").Top .Left = Range("b26").Left .Name = "Bar Chart" End With End With End If 

尝试

 With chart_1. .Axes(xlValue).MinimumScale = 0 .Axes(xlValue).MaximumScale = 5 End With