Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run sort macro on active worksheet
How can I make the code below work on any worksheet?
Sub SortByDate() ActiveWorkbook.Worksheets("DateCheck").Sort.SortFi elds.Clear ActiveWorkbook.Worksheets("DateCheck").Sort.SortFi elds..Add Key:=Range( _ "C4:C24"), SortOn"=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal With ActiveWorkbook.Worksheets("DateCheck").Sort .SetRange Range( "B3:K24" ) .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run sort macro on active worksheet
Use ActiveSheet rather than, ActiveWorkbook.Worksheets("DateCheck").
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reference active worksheet from macro in personal.xls | Excel Programming | |||
Need to identify active worksheet in macro | Excel Worksheet Functions | |||
I need to sort an active sheet using the col of the active cell | Excel Programming | |||
How to end macro on inital active worksheet containing macro button that was clicked | Excel Programming | |||
macro to apply worksheet event to active worksheet | Excel Programming |