LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Excel Sort Problem...

So I have a sort problem. I have read many posts here and tried many
of the fixes to no avail so I write a new post.

The sort is kicked off by a label click. Here is the code I am using:

=======================
Called from here
=======================
Private Sub lblMainCost_Click()
SortMain ("S20")
Me.lblMainCost.SpecialEffect = fmSpecialEffectSunken
End Sub

=======================
Exectued here
=======================
Public Sub SortMain(SortColumnAndRow As String)

If Me.lstSeriesName.listIndex = -1 Then Exit Sub
Me.lstMain.listIndex = -1

TempList.Range("M20:W" & TempList.Cells(17, 24).Value - 1).Select
Selection.Sort Key1:=TempList.Range(SortColumnAndRow), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub
=======================

TempList is declared as a worksheet in the opening sub and resolves
properly.

I am getting the dreaded general 1004 error stating that the 'Sort
method of Range class failed'.

I have checked to make sure the range is not protected, not on a
hidden sheet and that the key is never blank. I have also removed the
'With' statements to reduce the 'dot' mistakes and removed unnessary
variables in favor of direct calls to cell values.

I have similar problems with another program being used the same way,
so I think its either the way its called or some of my syntax.

Any help here would be great!

 
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
excel 2007 sort problem cindy Excel Worksheet Functions 2 October 3rd 07 01:01 PM
excel sort problem Daniel Excel Worksheet Functions 5 April 28th 07 09:34 PM
Zip code sort is an Excel problem even when using the special cat. camead Excel Discussion (Misc queries) 2 March 31st 05 01:15 AM
Sort problem in shared excel file Jan Grinwis Excel Programming 1 September 9th 04 11:11 PM
Excel 2k VBA problem - For loops interating a sort robert_m_mills[_2_] Excel Programming 3 June 9th 04 06:57 PM


All times are GMT +1. The time now is 06:47 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"