I have recorded a macro which sorts a particular coloumn, but i want a universal macro such that when i openup a workbook/worksheet itll sort coloumn D.
You can use your same sorting macro you already developed. Just save it in a workbook in your c:\Program Files\Microsoft Office\Office\Xlstart directory. You will also want to develop a File Open macro that you can run the sorting macro on as soon as it opens.
Code:
Sub fOpen()
Dim fName As String
fName = Application _
.GetOpenFilename("Excel Files (*.xls), *.xls")
If fName = "" Then
Exit Sub
End If
Workbooks.Open (fName)
Application.Run "fSort"
End Sub
Private Sub fSort()
ActiveSheet.Range("D1").Sort key1:=Range("D1"), order1:=xlDescending
End Sub
[\code]
Dan.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.