I have this Macro for alphabetically sorting a cells in column AB
I would like the macro to work with other worksheets however the other worksheets in the workbook have different titles to BRIM.
What would I change in this macro so that it would work with other worksheets??
Many thanks in advance
' PWRII Macro''LR = Worksheets("BRIM").Range("AB" & Rows.Count).End(xlUp).RowActiveWorkbook.Worksheets("BRIM").Sort.SortFields.ClearActiveWorkbook.Worksheets("BRIM").Sort.SortFields.Add Key:=Range("AB2:AB" & LR) _, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormalWith ActiveWorkbook.Worksheets("BRIM").Sort .SetRange Range("A1:AB" & LR) .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .ApplyEnd WithEnd Sub</pre>
I would like the macro to work with other worksheets however the other worksheets in the workbook have different titles to BRIM.
What would I change in this macro so that it would work with other worksheets??
Many thanks in advance
' PWRII Macro''LR = Worksheets("BRIM").Range("AB" & Rows.Count).End(xlUp).RowActiveWorkbook.Worksheets("BRIM").Sort.SortFields.ClearActiveWorkbook.Worksheets("BRIM").Sort.SortFields.Add Key:=Range("AB2:AB" & LR) _, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormalWith ActiveWorkbook.Worksheets("BRIM").Sort .SetRange Range("A1:AB" & LR) .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .ApplyEnd WithEnd Sub</pre>