Sorting Data in Excel using VBA Code

preview_player
Показать описание
Writing VBA Code some times much better than manually working in Excel. Watch this video to learn how to use VBA code for Sorting the Data. Many more Videos to come. Please SUBSCRIBE
Рекомендации по теме
Комментарии
Автор

I'm using the below VBA script since I keep adding new data columns every week (so dynamic). So I'm trying to figure out the last column in the variable - ColumnAdd.
I'm able to get the value of ColumnAdd as "AY" which is correct, but getting error when I use it in the 2nd last line at SortFields.
Error is --> Expected List Separator or )

Dim Addr As String
Dim ColumnAdd As String
Dim rng As Range
Sheets("OMOP").Select

Addr = ActiveCell.Address
ColumnAdd = Mid(Addr, 2, InStr(2, Addr, "$") - 2)

Set rng = Range("A7",

With ActiveSheet.Sort

'clear previous sort criteria

.SortFields.Clear
.Header = xlYes
.Orientation = xlTopToBottom
.SetRange rng
.SortFields.Add Key:=Range(ColumnAdd:ColumnAdd), Order:=xlAscending
.Apply

belindamalani
Автор

HOW WE CAN RANK STUDENT IN RESULT VBA CODE

farhanislam
Автор

All are good But ".Apply" are not working

mahaveerchand