Anne Troy
asked on
Convert Recorded Macro Selections to Current Selection Excel 2007
Here's a recorded macro. I'm having no luck changing the selection(s) to "active selection". I think the search terms required to get an answer are simply too generic.
Bottom line: I want to sort the active selection without being prompted to extend it. Sort A-->Z. I will run the macro from a shape on the worksheet, so I just need a standard sub. Thanks soooo much!!
Bottom line: I want to sort the active selection without being prompted to extend it. Sort A-->Z. I will run the macro from a shape on the worksheet, so I just need a standard sub. Thanks soooo much!!
Sub Macro3()
'
' Macro3 Macro
'
'
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("G5"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("G5:G11")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
photo finish.
:)
ASKER
LOL. I'll check it out tomorrow guys! Thanks so much. :D
ASKER
Beauteous! Thanks!