sort excel when the workbook is opened
Thanks, I have pasted that code by clicking view code on sheet1 of my
worksheet and then pasting the code you gave me and it works if I select the
macro and run it but I want it to be sorted automatically without having to
press anything. Have I done something wrong?
"Mike" wrote:
This will sort column A on sheet 1 every time the workbook is opened. You
will have to change the worksheet name and maybe ascendind/descending
Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Cells.Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending
End Sub
Mike
"Michael" wrote:
Hi, could anyone tell me how to automatically sort a worksheet when the
workbook is opened please?
ie I have data in column A in sheet1 on workbook1 that is linked to
workbook2. When I open workbook1 the data in workbook2 may have been changed
and I want to sort the data in column A, workbook1 without having to click
sort.
Thank you in anticipation.
|