Excel VBA error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have recorded a macro to sort within a range and have assigned it to a
forms-button. It runs well while executing on XP machine. But people who try
to run it from their 2000 OS get the following error.
"Can't execute code in break mode"
I am not able to reproduce this error on my XP machinee. Please help
 
Hi Bob,
The code is as follows. This works perfectly well on XP but gives an error
on 2000.

Sub sortmanagermajor()
'Range("C2").Select
Range("A1:lastcellmajor").Sort Key1:=Range("C2"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Thanks in advance
 
I assume "lastcellmajor" is a defined name/range.

Try changing it to this

Sub sortmanagermajor()
'Range("C2").Select
Range("A1:lastcellmajor").Sort _
Key1:=Range("C2"), Order1:=xlAscending,
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

I don't think xl2000 supported the DataOption1 argument (and it isn't
needed).

To get out of break mode, in the vbe, hit the reset button.
 
Leena said:
Hi
I have recorded a macro to sort within a range and have assigned it to a
forms-button. It runs well while executing on XP machine. But people who try
to run it from their 2000 OS get the following error.
"Can't execute code in break mode"
I am not able to reproduce this error on my XP machinee. Please help

Are you sure the macro sorts exactly the same data on both machines?

/Fredrik
 
Hi Leena

remove
, _
DataOption1:=xlSortNormal

from your code and see if it works - i think i've had this problem in the
past where a macro recorded in 2003 puts this parameter in but it's not
supported in 2000.

Cheers
JulieD
 

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

Back
Top