Code execution has been interupted Problem

guybrown

Board Regular
Joined
Jul 2, 2008
Messages
100
hi all!

It sometimes highlights End With and sometimes highlights Range("C2:C10001").Select

Any idea what the problem might be?

Guy xp prof xl 2007


Sub Text_on_XY()

'AutoFill
Range("C2:C2").AutoFill Destination:=Range("C2:C" & Cells(Rows.Count, "B").End(xlUp).Row)
'Paste formula result as value
Range("C2:C10001").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

'Sort 1 2 3
Range("C2:D10001").Select
ActiveWorkbook.Worksheets("Text on XY").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Text on XY").Sort.SortFields.Add Key:=Range( _
"D2:D8"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Text on XY").Sort
.SetRange Range("C2:D10001")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I've not seen an explanation for that, but maybe putting:

Application.EnableCancelKey = xlDisabled

at the beginning of your code will fix the problem.
 
Upvote 0
It sounds like you hit the Esc key (or there was a hit pending) while your code was running.

In rare cases, anyway, VBA keeps stopping where you placed a breakpoint, even if the breakpoint has been subsequently deleted. In that case the only solution is to copy the module code, drop the module, insert another and copy the code back. It's a bug, no use to say.
 
Upvote 0
In rare cases, anyway, VBA keeps stopping where you placed a breakpoint, even if the breakpoint has been subsequently deleted. In that case the only solution is to copy the module code, drop the module, insert another and copy the code back. It's a bug, no use to say.

That sounds like a plausible explanation, although I don't remember having set and removed a break point when it's happened to me. It's certainly some sort of bug.
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,664
Members
448,976
Latest member
sweeberry

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