ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Morning,
I currently have the following code which works fine.
I would like to apply a date sort of column A when the worksheet is opened.
So the first Row/Cell A8 which is the oldest date say 01/05/2015 then as as you go down each row the date will become more recent.
My code is now shown below BUT my sort is new at A8 & oldest at the last current row.
This should be the opposite way.
I also notice that when this code sort has run my data filters which allow me to sort other columns etc are removed.
I currently have the following code which works fine.
Code:
Private Sub Worksheet_Activate()
Application.GoTo Sheets("POSTAGE").Range("A" & Rows.Count).End(xlUp).Offset(1, 0), True
ActiveWindow.SmallScroll UP:=10
PostageTransferSheet.Show
End Sub
I would like to apply a date sort of column A when the worksheet is opened.
So the first Row/Cell A8 which is the oldest date say 01/05/2015 then as as you go down each row the date will become more recent.
My code is now shown below BUT my sort is new at A8 & oldest at the last current row.
This should be the opposite way.
I also notice that when this code sort has run my data filters which allow me to sort other columns etc are removed.
Code:
Private Sub Worksheet_Activate()
Dim x As Long
Application.ScreenUpdating = False
With Sheets("POSTAGE")
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A8:I" & x).Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess
End With
ActiveWorkbook.Save
Application.ScreenUpdating = True
Application.GoTo Sheets("POSTAGE").Range("A" & Rows.Count).End(xlUp).Offset(1, 0), True
ActiveWindow.SmallScroll UP:=10
PostageTransferSheet.Show
End Sub