Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am pleased to say your solution was successful.
I will need to tweak it a bit though. Thank you Gotroots "Dave Peterson" wrote: I'd use the old xl2003 syntax (still supported in xl2007): dim wkbk as workbook dim wks as worksheet set wkbk = Workbooks.Open(Filename:="Z:\Excel docs\Uses\Uses_A.xlsm") set wks = wkbk.worksheets("A") with wks with .range("B11:z7800") .sort key1:=.columns(1), order1:=xlAscending, _ Header:=xlYes, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlTopToBottom end with end with ============= I guessed that your data had headers in row 11. I see by your code that you're not including column A in the sort range. If you meant that, then ignore this. But if you wanted to include column A and sort by column B, you could use: with wks with .range("a11:z7800") .sort key1:=.columns(2), order1:=xlAscending, _ Header:=xlYes, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlTopToBottom end with end with Gotroots wrote: I am puzzled why the following code stops when it reaches Range("B11:Z7800").Select Workbooks.Open Filename:="Z:\Excel docs\Uses\Uses_A.xlsm" Sheets("A").Select Range("B11:Z7800").Select ActiveWorkbook.Worksheets("A").Sort.SortFields.Cle ar ActiveWorkbook.Worksheets("A").Sort.SortFields.Add Key:=Range("B11:B7800" _ ), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("A").Sort .SetRange Range("B11:Z7800") Anyone see something not quite right with the code. Thank you for your time. -- Dave Peterson . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating workbook with an alpha sort sheet and a numeric sort shee | Excel Discussion (Misc queries) | |||
sort function for dates does not sort properly in Office 2007 Exc. | Excel Worksheet Functions | |||
Macro in File halted All Visual Basic Settings? | Excel Programming | |||
Pls. reply Sort Data and copy to next coulmn when sort order chang | Excel Programming | |||
How to obtail a list of all Variables with values in halted proced | Excel Discussion (Misc queries) |