dcunningham
Board Regular
- Joined
- Jul 14, 2015
- Messages
- 58
Hi Everyone,
I'm trying to call a sub called ScaleAxes that sits in a module elsewhere. The ScaleAxes code is:
The code I'm trying to call it in is here:
ScaleAxes works on its own when I run it separately, and no error comes up when the code it's called in is run. The problem is that the code above seems to run properly, but the ScaleAxes code doesn't run.
Any help you can provide helping me remedy this issue would be appreciated.
Regards,
Dan
I'm trying to call a sub called ScaleAxes that sits in a module elsewhere. The ScaleAxes code is:
Code:
Option Explicit
Sub ScaleAxes()
Worksheets("Dashboard").ChartObjects("Measure Chart").Activate
With ActiveChart.Axes(xlCategory, xlPrimary)
.MaximumScale = Sheets("Lists and Data").Range("R7").Value
.MinimumScale = Sheets("Lists and Data").Range("Q7").Value
.MajorUnit = Sheets("Lists and Data").Range("S7").Value
End With
With ActiveChart.Axes(xlValue, xlPrimary)
.MaximumScale = Sheets("Lists and Data").Range("R9").Value
.MinimumScale = Sheets("Lists and Data").Range("Q9").Value
.MajorUnit = Sheets("Lists and Data").Range("S9").Value
End With
End Sub
The code I'm trying to call it in is here:
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("H2:N2")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Dim addIn As COMAddIn
Dim automationObject As Object
Set addIn = Application.COMAddIns("PI DataLink")
Set automationObject = addIn.Object
Dim MyRange As Range
Set MyRange = Range("J2")
MyRange.Select
automationObject.SelectRange
automationObject.ResizeRange
Application.CalculateFull
End If
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
[COLOR=#ff0000] Call ScaleAxes[/COLOR]
End If
End Sub
ScaleAxes works on its own when I run it separately, and no error comes up when the code it's called in is run. The problem is that the code above seems to run properly, but the ScaleAxes code doesn't run.
Any help you can provide helping me remedy this issue would be appreciated.
Regards,
Dan