I am sure that it is really easy, but I can not find information about it.
I have an Excel macro that has things like:
ActiveWorkbook.Worksheets("Data 21 Oct 12 11-05").Sort.SortFields.Clear ActiveWorkbook.Worksheets("Data21 Oct 12 11-05").Sort.SortFields.Add Key _ :=Range("W1:W23"), SortOn:=xlSortOnValues, Order:=xlDescending, _ DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("Data 21 Oct 12 11-05").Sort .SetRange Range("A1:BZ23") .Header = xlGuess .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With
I want to make this a global macro, but the file name is hardcoded in the macro. How can I change the code to refer to the "this" currently open file?
source share