Excel VBA

Topic Name

how to sort in excel automatically VBA


Goto VBA Editor Press ALT F11

And Object Select Worksheet

and Code Here Copy and Paste Excel VBA

Const rng_sorting As String = "C:C"
Const rng_Dataset As String = "A:D"


Private Sub Worksheet_SeletionChange(ByVal Target As Range)

Dim tgrcol As Long
If Not Intersect(target, Range(rng_sorting)) is Nothing Then

tgrcol = Target.column
Columns(rng_dataset).Sort Key1:=Columns(tgrcol), _
Order1:=XlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=XlTopToBottom
End IF

End Sub

Final Code Preview Here


View Microsoft Excel Option Click and Change Value Column C and New Data automatic Update Column After Data Entry.👍





No comments:

Post a Comment