Hello
Each month I need to create a report from some extracted data. There is just one worksheet, and the name varies from month to month.
What I'd like to do is have Excel just select that Worksheet. What the macro needs to do is sort the records into a specific order - the employee number, and that's where I'm stuck.
The current code is:
[pre]ActiveWorkbook.Worksheets("T53").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("T53").AutoFilter.Sort.SortFields.Add Key:=Range( _
"E1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal[/pre]
T53 happens to be the name of the worksheet this time, but it varies. I've tried ActiveWorkbook.ActiveWorksheet without a name and also tried With ActiveWorksheet, but I can't get the sort function to work.
Can anyone help please?
thanks
thank you for helping
____________
Pendle
Each month I need to create a report from some extracted data. There is just one worksheet, and the name varies from month to month.
What I'd like to do is have Excel just select that Worksheet. What the macro needs to do is sort the records into a specific order - the employee number, and that's where I'm stuck.
The current code is:
[pre]ActiveWorkbook.Worksheets("T53").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("T53").AutoFilter.Sort.SortFields.Add Key:=Range( _
"E1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal[/pre]
T53 happens to be the name of the worksheet this time, but it varies. I've tried ActiveWorkbook.ActiveWorksheet without a name and also tried With ActiveWorksheet, but I can't get the sort function to work.
Can anyone help please?
thanks
thank you for helping
____________
Pendle