D
Dawn
Hi -- I have a macro I recorded that's doing some formatting on a report.
One part of the macro is looking at the name of the worksheet, but it's not
always the same name. Is there any way to alter this code so it works no
matter what the worksheet name is? It really just needs to select a
particular column, I'm not sure why it's looking at the worksheet name at
all. Thanks for any advice!
-Dawn
ActiveWorkbook.Worksheets("Docket_Report 1 ").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Docket_Report 1 ").Sort.SortFields.Add _
Key:=Range("H2"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Docket_Report 1 ").Sort
.SetRange Range("A3:I45")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
One part of the macro is looking at the name of the worksheet, but it's not
always the same name. Is there any way to alter this code so it works no
matter what the worksheet name is? It really just needs to select a
particular column, I'm not sure why it's looking at the worksheet name at
all. Thanks for any advice!
-Dawn
ActiveWorkbook.Worksheets("Docket_Report 1 ").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Docket_Report 1 ").Sort.SortFields.Add _
Key:=Range("H2"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Docket_Report 1 ").Sort
.SetRange Range("A3:I45")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With