Terri Jarus
jarus at amerinet-gpo.com
Mon Mar 24 07:42:16 CST 2003
Here's the code I finally figured out to allow the user to define a
range:
Dim UserRange As Range
Prompt = "Select the rows to be sorted."
Title = "Sort Rows"
On Error Resume Next
Set UserRange = Application.InputBox( _
Prompt:=Prompt, _
Title:=Title, _
Default:=ActiveCell.Address, _
Type:=8)
Range(UserRange, ActiveCell.Offset(0, 17)).Select
Selection.Sort Key1:=Range("F9"), Order1:=xlAscending,
Key2:=Range("E9") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase:= _
False, Orientation:=xlTopToBottom
Application.Goto Reference:="bottom"
End Sub
I adapted some code I found at The Spreadsheet Page website by John
Walkenbach - j-walk.com/ss/ - to give appropriate credit.
Thanks for everyone's suggestions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030324/03342205/attachment-0001.html>