Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Sort problem - perplexing and annoying in the extreme

Hello out there. I have a line of code to sort a range that has only pasted
values in it, there are no formulas whatsoever.
F_REF.Range("AA54:AE72").Sort Key1:=F_REF.Range("AE72"), _
Order1:=xlAscending, Key2:=F_REF.Range("AB72"), Order1:=xlAscending

F_REF has previously been set to the sheet name.

Now sometimes this line of code works, and sometimes it doesn't (at the
moment it has decided not to work at all). Normally, for this macro, I have
calculation off, but in debugging I have tried calc to auto and it doesn't
make any difference (and nor should it, because they are values only).

What is particularly aggravating about this "non-sorting" is that it ALWAYS
works if I either execute the line by stepping through the code, or if I run
a little stand-alone macro that executes the sorting macro.

How can this possibly be please? Regards, Brett
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Sort problem - perplexing and annoying in the extreme

In the interim I've spotted a couple of things in the line of code. I hadn't
specified Order2 for the second key, and both keys were set to the last row
rather than the first (AE72 should be AE54 et al). HOWEVER, that still
doesn't explain why it works when it's done manually, which means that I'm
still looking for an explanation of what might be going on.

"Brett" wrote:

Hello out there. I have a line of code to sort a range that has only pasted
values in it, there are no formulas whatsoever.
F_REF.Range("AA54:AE72").Sort Key1:=F_REF.Range("AE72"), _
Order1:=xlAscending, Key2:=F_REF.Range("AB72"), Order1:=xlAscending

F_REF has previously been set to the sheet name.

Now sometimes this line of code works, and sometimes it doesn't (at the
moment it has decided not to work at all). Normally, for this macro, I have
calculation off, but in debugging I have tried calc to auto and it doesn't
make any difference (and nor should it, because they are values only).

What is particularly aggravating about this "non-sorting" is that it ALWAYS
works if I either execute the line by stepping through the code, or if I run
a little stand-alone macro that executes the sorting macro.

How can this possibly be please? Regards, Brett

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perplexing string manipulation problem Russ Jones Excel Programming 4 July 10th 08 12:37 PM
Annoying Problem Mark Dullingham Excel Programming 0 May 16th 06 01:48 AM
Annoying problem Barney Excel Discussion (Misc queries) 3 March 17th 06 12:47 PM
very annoying problem Please help Frank New Users to Excel 8 September 11th 05 08:18 PM
Help with perplexing form problem Frustrated Excel Programming 6 April 26th 04 09:21 PM


All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"