code execution has been interrupted - Excel 2010 v Excel 2007

eoinymc

Board Regular
Joined
Jan 29, 2009
Messages
203
Hi guys,

can anyone help me please?!

I have code that was working in Excel 2007, but I have upgraded my version of Office to 2010 and for some reason, the code keeps throwing back the error "Code Execution has been interrupted".

It seems to always stop on the NumberFormats of the following code:

Code:
Set TrendA = Sheets("Trend Analysis")

If (TrendA.Range("U33") = "A" Or TrendA.Range("U33") = "B") Then
        TrendA.Range(TrendA.Cells(39, 5), TrendA.Cells(44, 17)).NumberFormat = "#,##0.0%"
        TrendA.ChartObjects("CompChart2").Chart.Axes(xlValue).TickLabels.NumberFormat = "#,##0.0%"
ElseIf (TrendA.Range("U33") = "C" Or TrendA.Range("U33") = "D" Or TrendA.Range("U33") = "E" Or TrendA.Range("U33") = "F" Or TrendA.Range("U33") = "G") Then
        TrendA.Range(TrendA.Cells(39, 5), TrendA.Cells(44, 17)).NumberFormat = "#,##0.00_ ;[Red](#,##0.00)"
        TrendA.ChartObjects("CompChart2").Chart.Axes(xlValue).TickLabels.NumberFormat = "#,##0.00_ ;[Red](#,##0.00)"
Else
        TrendA.Range(TrendA.Cells(39, 5), TrendA.Cells(44, 17)).NumberFormat = "#,##0_ ;[Red](#,##0)"
        TrendA.ChartObjects("CompChart2").Chart.Axes(xlValue).TickLabels.NumberFormat = "#,##0_ ;[Red](#,##0)"
End If

The code is basically setting a NumberFormat based on what option is chosen.

Has anyone got any ideas as to why this is happening? As I said, it worked fine in Excel 2007, but won't work now....so so so so so so frustrating!

Thanks,

Eoin
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
ok, I think I got this...well, it works for me anyway...

After trying so many things online, this one seems to be the best.

Put this in the first line of your macro and Robert is your mother's brother:

Code:
[COLOR=#000000][FONT=Arial]Application.EnableCancelKey = xlDisabled[/FONT][/COLOR]

Cheers,

E
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top