- #EXCEL PIVOT CHART VERTICAL LINE CHANGE THE NUMBER UPDATE#
- #EXCEL PIVOT CHART VERTICAL LINE CHANGE THE NUMBER PORTABLE#
- #EXCEL PIVOT CHART VERTICAL LINE CHANGE THE NUMBER CODE#
MaximumScaleIsAuto = True If MinOrMax = "Min" Then. MinimumScaleIsAuto = True End If End With End If 'Set value of secondary axis If (ValueOrCategory = "Value" Or ValueOrCategory = "Y") _Īnd PrimaryOrSecondary = "Secondary" Then With cht.Axes(xlValue, xlSecondary)Įlse If MinOrMax = "Max" Then. MaximumScale = ValueĮlse If MinOrMax = "Max" Then. If IsNumeric(Value) = True Then If MinOrMax = "Max" Then. MinimumScaleIsAuto = True End If End With End If 'Set Category of Primary axis If (ValueOrCategory = "Category" Or ValueOrCategory = "X") _Īnd PrimaryOrSecondary = "Primary" Then With cht.Axes(xlCategory, xlPrimary) MinimumScale = ValueĮlse If MinOrMax = "Max" Then. 'Set Value of Primary axis If (ValueOrCategory = "Value" Or ValueOrCategory = "Y") _ ValueOrCategory As String, PrimaryOrSecondary As String, Value As Variant)ĭim valueAsText As String 'Set the chart to be controlled by the function Set cht = .Sheets(sheetName) _ Function setChartAxis(sheetName As String, chartName As String, MinOrMax As String, _
#EXCEL PIVOT CHART VERTICAL LINE CHANGE THE NUMBER CODE#
Here is the VBA code to copy into the Module. The code for UDFs must be within a standard module to work. The Visual Basic Editor window will open, click Insert -> ModuleĪdd the code below to the Module as shown. To create the UDF click Developer -> Visual Basic (or shortcut ALT + F11). Right-click on a blank part of the ribbon and select Customize the Ribbon… from the menuįrom the Excel Options window click Customize Ribbon, enable the Developer option then click OK.
#EXCEL PIVOT CHART VERTICAL LINE CHANGE THE NUMBER UPDATE#
Whether these values are typed in the cell or created using formulas, they will update the chart. The values in the cell are automatically applied to the chart. The animated gif below shows the solution in action. Thankfully, the minimum and maximum values of the chart axis are controllable using a UDF. For example, it is possible to change a worksheet’s tab color, or to change a chart title (next week’s post). Whether on purpose or by accident, Microsoft have made it possible to control various objects with UDFs. UDF’s are intended to be custom worksheet functions to calculate a cell value. User Defined Functions (UDFs for short) are just like normal Excel functions, such as VLOOKUP or SUM, but they have been created using VBA.