June 26, 2019

Sort Data in Worksheet As We Type Automatically

How to sort data in a worksheet as we type quickly, easily and automatically with VBA. Watch the video below:

Watch this video on YouTube.

Here’s the VBA code to sort data automatically:

Private Sub Worksheet_Change(ByVal Target As Range)
Range(“A1”).CurrentRegion.Sort _
Key1:=Range(“B1”), Order1:=xlAscending, Header:=xlYes
End Sub

Earlier we had shown how to sort data in a worksheet automatically using a recorded macro.