I did use the macro recorder and this is what I end up with.
Sub quick_sort()
'
' quick_sort Macro
'
' Keyboard Shortcut: Ctrl+h
'
Rows("254:262").Select
Range("B254").Activate
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range( _
"F254:F262"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A254:X262")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
The recorder produces a script that will sort rows 254:262 in worksheet Sheet1. I need this to be more generic and sort whatever rows I have selected at the time when I run the macro. Ideally, I would just like to select some rows and keystroke the shortcut. I don't know VB anywhere near well enough to make those changes.
LMHmedchem
Bookmarks