LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Class Modules - referring to workbook properties

Hi Bob, yes, F_REF is a sheet, and that reference is used several times
before the sort. What I'm saying is that if I put a breakpoint on the sort
and then press F8 to step through the code it works. Now then, since I sent
my original Q to you this morning (Sydney time) I've discovered the most
bizarre thing. If the cells that are being sorted are hidden then the sort
fails. If they are not hidden it works (with the automatic macro as well).
When I was stepping through the code I had the rows/cols unhidden so that I
could see what was going on (with a split screen) and was thus able to
detirmine that the code actually does work in "manual". Of course every time
it runs on auto the cells are hidden, and that's when it fails.

So, to counteract this problem what I have to do is unhide rows/cols before
the sort and then re-hide, and it works every time.That's not normal
behaviour is it? I mean, for crying out loud, you have to be able to sort a
hidden range, especially given that you can select a hidden range.

Just to clarify, when I run it manually I'm not using other lines of code -
they are the very same lines, not even copied to somewhere else.

BTW, a) the curry was good, b) my partner tracked the mohican cartoon on
YouTube at
http://www.youtube.com/watch?v=bHCpdXsn-NY
I hadn't seen it for years.



"Bob Phillips" wrote:

Brett,

I normally find that when things work manually but not automatically it is
down to objects that are not fully qualified, because I select the sheet or
whatever when stepping it.

But, assuming that F_REF is a worksheet object, your code looks fully
qualified so it would not appear to be the problem.

Without the context, it is hard to offer any other advice.

--
__________________________________
HTH

Bob

"Brett" wrote in message
...
Hi Bob

I posted a question yesterday but haven't had any takers, and now it's
becomng urgent (it's the last problem to vercome before I go live).

I have the following line in a macro:

F_REF.Range("Y54:AE72").Sort Key1:=F_REF.Range("AE54"),
Order1:=xlAscending,
Key2:=F_REF.Range("AB54"), Order2:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal

Most often when this line is run automatically, it doesn't sort, but there
are times when it does (rare). If I step through the code then the sort
works
EVERY time. Similarly, if I execute the macro manually by clicking a text
box, it works every time.

I've tried it with calc Auto/Manual and it makes no difference whatsoever.

I am at a complete loss with this. I cannot understand how it can work
manually but not as part of a macro that runs it automatically.

I am working with the same test data set in every instance (i.e. when it
works and when it doesn't). Do you have any idea what could be causing
this,
and if not how I could work around it please?

I've tried putting just the sort line into a separate macro, and that
worked
for a little while, but now that too fails to work ( I thought I had it
licked with a work-around but not to be). Regards, Brett






 
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
Class modules: parametrize class object fields Jean-Pierre Bidon Excel Programming 11 August 31st 06 02:49 PM
Basic question - modules and class modules - what's the difference? Mark Stephens[_3_] Excel Programming 9 May 8th 05 11:48 AM
Class Modules Pavlos Excel Programming 5 January 19th 05 05:31 PM
Class Modules ibeetb Excel Programming 1 January 5th 04 10:04 PM
Class Modules vs Modules Jeff Marshall Excel Programming 2 September 28th 03 07:57 PM


All times are GMT +1. The time now is 05:03 AM.

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"