This is likely to be an easy challenge for most of you experts: I have a very helpful macro which I generated via "Record Macro". I want to be able to run it on ANY similarly structured worksheet. Alas, it appears to have the original sheet name embedded (see code below). Can I replace the sheet name (REPORT-Q1-2013) to have it auto reference whatever sheet I happen to be running it in i.e a generic sheet ref? Appreciate any help
End With
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Rows("2:67").Select
ActiveWindow.SmallScroll ToRight:=3
ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort.SortFields.Add Key:= _
Range("E2:E67"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort.SortFields.Add Key:= _
Range("AB2:AB67"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort
.SetRange Range("A2:AF67")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Rows("2:67").Select
ActiveWindow.SmallScroll ToRight:=3
ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort.SortFields.Add Key:= _
Range("E2:E67"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort.SortFields.Add Key:= _
Range("AB2:AB67"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("REPORT-Q1-2013").Sort
.SetRange Range("A2:AF67")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With