Greetings All,
I wrote a macro to clean up some of our spreadsheets, part of the process is doing a sort when it's done. The problem is it's workbook or worksheet specific and my VBA isn't good enough to be able to remove the part of the code to make it work in all work books.
I tried removing Worksheets("CGF") and ActiveWorkbook.Worksheets("CGF") from the code and it won't run in my other files. FYI, this macro is in my PERSONAL.XLSB file.
Would appreciate any help.
Thanks
I wrote a macro to clean up some of our spreadsheets, part of the process is doing a sort when it's done. The problem is it's workbook or worksheet specific and my VBA isn't good enough to be able to remove the part of the code to make it work in all work books.
Code:
ActiveWorkbook.Worksheets("CGF").Sort.SortFields.Add Key:=Range("A2:A63"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("CGF").Sort
.SetRange Range("A1:T63")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
I tried removing Worksheets("CGF") and ActiveWorkbook.Worksheets("CGF") from the code and it won't run in my other files. FYI, this macro is in my PERSONAL.XLSB file.
Would appreciate any help.
Thanks