Worksheet Change Sub problem

J

jwlabno

Hello,
I have a problem with Sub Worksheet Change below. Not sure if it is the code
or some system setting.
The problem is that it does not run when changes are made on the sheet it's
attached to. I tried to trace the problem in VB and the sub does not get
activated at all (not just because the condition in the sub is false) - I
tried enable events but it's not it.

Any thoughts of where the problem could be and how to solve it?

Not sure if this matters but I have an XLA attached. The workbook does not
contain any code except the SUB below and all my macros are loaded via
Reference to external XLA module. The funny part is that it worked once or
twice after I wrote it then for some reason, stopped.

Confused
Jack


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row >= 41 And Target.Row <= 42 _
And Target.Column >= 10 And Target.Column <= 14 _
Then

ActiveSheet.ChartObjects("Chart 10").Activate

ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = Sheets("Payoff").Range("J42").Value
.MaximumScale = Sheets("Payoff").Range("K42").Value
.MinorUnit = Sheets("Payoff").Range("L42").Value
.MajorUnit = Sheets("Payoff").Range("M42").Value
.Crosses = xlCustom
.CrossesAt = Sheets("Payoff").Range("N42").Value
.ReversePlotOrder = False
.ScaleType = xlLinear
End With

ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScale = Sheets("Payoff").Range("J41").Value
.MaximumScale = Sheets("Payoff").Range("K41").Value
.MinorUnit = Sheets("Payoff").Range("L41").Value
.MajorUnit = Sheets("Payoff").Range("M41").Value
.Crosses = xlCustom
.CrossesAt = Sheets("Payoff").Range("N41").Value
.ReversePlotOrder = False
.ScaleType = xlLinear
End With

Sheets("Payoff").Range("A1").Select
End If
End Sub
 
T

Trevor Shuttleworth

Jack

works for me ... at least in terms of activating the routine. I can only
test it so far as I don't have the data.

Are you sure it's in the sheet code for the sheet that you are changing ?

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top