Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Custom Sort order issue

Maybe you could add the customlist in code, do the sort, and remove the
customlist.

Maybe you can add the customlist, use it and delete it all in code:

Option Explicit
Sub testme01()

Dim myArr As Variant
Dim myListNumber As Long
Dim myRng As Range

With Worksheets("Hidden")
myArr = .Range("A1:A" & .Cells(.Rows.Count, "A").End(xlUp).Row).Value
End With

'or lose the hidden sheet and do it all in code???
'myArr = Array("Grape", "Apple", "Orange", "Banana", "Melon")

Application.AddCustomList listarray:=myArr
myListNumber = Application.GetCustomListNum(myArr)

Set myRng = Worksheets("Sheet999").Range("a1:k30")

With myRng
.Cells.Sort key1:=.Columns(1), Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=myListNumber + 1
End With

Application.DeleteCustomList myListNumber

End Sub



ATChurch wrote:

Hi. I have created a custom sort order by using a list in a hidden sheet in a
workbook. This is then followed by two default sorts.

I recorded a macro of this sort being performed on each of the sheets in the
work book and then used the Visual Basic edittor to make it run each time the
workbook is opened.

The problem is, this works perfectly for me, but when I emailed it to my
collegues who will also use it, the custom sort had reverted to a default
(alphabetical) sort.

Further, when they email me back the edited table, the macro works fine when
I open it.

What's going on?

PS: The custom sort is for a table containing a "High/Medium/Low" rating
column and it is instead sorting to "High/Low/Medium".


--

Dave Peterson
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
Custom Sort Order - Wildcard? Budget Programmer Excel Worksheet Functions 2 April 22nd 23 04:10 AM
Add sort order to custom header? LauraB Excel Discussion (Misc queries) 0 February 18th 10 06:29 AM
Macro with custom sort order Erin Excel Worksheet Functions 4 January 5th 09 05:08 PM
Custom Sort Order Fishnerd Excel Discussion (Misc queries) 2 January 7th 08 06:24 AM
Can I save a custom sort order for a specific spreadsheet? BarKay Excel Worksheet Functions 1 March 14th 07 03:19 PM


All times are GMT +1. The time now is 05:15 PM.

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

About Us

"It's about Microsoft Excel"