M merjet Mar 14, 2007 #2 You can do it w/o a macro using the menu Data | Sort. If you want a macro, use the macro recorder. Merjet
You can do it w/o a macro using the menu Data | Sort. If you want a macro, use the macro recorder. Merjet
G Guest Mar 14, 2007 #3 Or you can use the example in the VBA help files: Sub SortRange() Worksheets("Sheet1").Range("E1").Sort _ Key1:=Worksheets("Sheet1").Columns("E"), _ Header:=xlGuess End Sub
Or you can use the example in the VBA help files: Sub SortRange() Worksheets("Sheet1").Range("E1").Sort _ Key1:=Worksheets("Sheet1").Columns("E"), _ Header:=xlGuess End Sub
G Guest Mar 17, 2007 #4 thank you it worked but i want when Excle open it automaticaly run this macro . the name of my macro is Sort
thank you it worked but i want when Excle open it automaticaly run this macro . the name of my macro is Sort
G Guest May 16, 2007 #5 Hi Bijan, In order to sort your list every time you open the workbook, write your code as follows: Private Sub Workbook_Open() Worksheets("Sheet1").Range("E1").Sort _ Key1:=Worksheets("Sheet1").Columns("E"), _ Header:=xlGuess End Sub In VB help section, this would be listed under "Open Event". Hope this helps cheers, Tendresse
Hi Bijan, In order to sort your list every time you open the workbook, write your code as follows: Private Sub Workbook_Open() Worksheets("Sheet1").Range("E1").Sort _ Key1:=Worksheets("Sheet1").Columns("E"), _ Header:=xlGuess End Sub In VB help section, this would be listed under "Open Event". Hope this helps cheers, Tendresse