Thread
:
How to do an auto sort on sheet2
View Single Post
#
4
Posted to microsoft.public.excel.programming
Claus Busch
external usenet poster
Posts: 3,872
How to do an auto sort on sheet2
Hi,
Am Sat, 21 Oct 2017 08:39:00 -0700 (PDT) schrieb
:
Sorry, forgot to add in my description that there is a header in cell A1. Sorry. How would your code look with this change? Thank you so much.
then try:
Private Sub Worksheet_Activate()
Dim LRow As Long
With Sheets("Sheet1")
LRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Application.ScreenUpdating = False
With Sheets("Sheet2")
.Range("A1").Resize(LRow).Value = _
Sheets("Sheet1").Range("A1:A" & LRow).Value
.UsedRange.Sort Key1:=Range("A1"), order1:=xlAscending, Header:=xlYes
End With
Application.ScreenUpdating = True
End Sub
Regards
Claus B.
--
Windows10
Office 2016
Reply With Quote
Claus Busch
View Public Profile
Find all posts by Claus Busch