I keep hoping one day I will be able to write code and not ask for help - but alas I need HELP still.
Background:
we work in 140 different workbooks and we change their worksheet name every week.
each workbook has a variable number of rows that we will select and then sort
the rows we are sorting do not start at 1 or have a set range each week
We have to take selected data in our worksheet and sort it by f, a, b, c and e.
I would like to write a macro that we can run that will sort the selected area for us.
Background:
we work in 140 different workbooks and we change their worksheet name every week.
each workbook has a variable number of rows that we will select and then sort
the rows we are sorting do not start at 1 or have a set range each week
We have to take selected data in our worksheet and sort it by f, a, b, c and e.
I would like to write a macro that we can run that will sort the selected area for us.
HTML:
[CODE]Sub sort_completed_worksheet()
'
' sort_completed_worksheet Macro
' this macro is used to sort our invoices after completion by: eft date(f), last name(a), first name(b), pt acct#(c), dos(d)
'
'
Dim wksData As Worksheet
Dim rngData As Range
Set wksData = ActiveSheet
Set rngData = Selection
ActiveWorkbook.Worksheets("56233").Sort.SortFields.Clear THIS SHEET NAME WILL CHANGE EACH WEEK AND WITH EACH WORKBOOK
ActiveWorkbook.Worksheets("56233").Sort.SortFields.Add Key:=Range( _
"F5467:F5578"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal THE SELECTED RANGE WILL CHANGE EACH WEEK AND WITH EACH WORKBOOK
ActiveWorkbook.Worksheets("56233").Sort.SortFields.Add Key:=Range( _
"A5467:A5578"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("56233").Sort.SortFields.Add Key:=Range( _
"B5467:B5578"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("56233").Sort.SortFields.Add Key:=Range( _
"C5467:C5578"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("56233").Sort.SortFields.Add Key:=Range( _
"E5467:E5578"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("56233").Sort
.SetRange Rows("5467:5578")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
[/CODE]