Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.
Option Explicit Dim Monitored Private Sub Worksheet_Activate() Monitored = Range("A76").Value 'Read in value prior to any changes End Sub Sub newScale() Dim PriYMin As Integer Dim PriYMax As Integer Dim SecYMin As Integer Dim SecYMax As Integer PriYMin = 0 PriYMax = Range("A76").Value SecYMin = 0 SecYMax = Range("A76").Value Worksheets("Ressource Data").ChartObjects(1).Activate 'Charts("Charts1").Activate If ActiveChart Is Nothing Then MsgBox "Please select the chart to modify first." Exit Sub End If 'With ActiveChart.Axes(xlCategory) '.MinimumScale = [xMin] '.CrossesAt = [xMin] '.MaximumScale = [xMax] 'End With With ActiveChart.Axes(xlValue) .MinimumScale = [PriYMin] .CrossesAt = [PriYMin] .MaximumScale = [PriYMax] End With With ActiveChart.Axes(xlValue, xlSecondary) .MinimumScale = [SecYMin] .CrossesAt = [SecYMin] .MaximumScale = [SecYMax] End With 'PriYMin = the minimum value I need on the primary y-axis 'PriYMax = the maximum value I need on the primary y-axis 'SecYMin = the minimum value I need on the secondary y-axis 'SecYMax = the maximum value I need on the secondary y-axis End Sub Private Sub Worksheet_Change(ByVal Target As Range) 'Prevent looping of code due to worksheet changes Application.EnableEvents = False 'Compare monitored cell with initial value If Range("E8").Value <> Monitored Then 'Do things as a result of a change Call newScale 'Reset Variable with new monitored value Monitored = Range("A76").Value End If 'Reset events Application.EnableEvents = True End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.