Jan 25 2022 09:37 AM - edited Jan 25 2022 09:54 AM
Hello Everyone,
I want to sort individual like DivisionSort, CategorySort and Total Sort.
So, what should i add in VBA code so it will sort individually??
Please help ...
Here is a attached file..
Jan 25 2022 12:06 PM
What do you mean by "sort individually"?
Jan 25 2022 08:25 PM
Jan 26 2022 01:29 AM
But that would break the connection between the data! For example, row 2 now has Division = West, Category = Technical Support and Total = $550. If you sort on Division, the division in row 2 will be East but the category will still be Technical Support and the total will still be 550.
But if you really want to completely mess up your data:
Sub DivisionSort()
Dim m As Long
m = Range("A" & Rows.Count).End(xlUp).Row
Range("A3:A" & m).Sort Key1:=Range("A3"), Header:=xlYes
MsgBox "Division column sorted", vbInformation
End Sub
Sub CategorySort()
Dim m As Long
m = Range("B" & Rows.Count).End(xlUp).Row
Range("B3:B" & m).Sort Key1:=Range("B3"), Header:=xlYes
MsgBox "Category column sorted", vbInformation
End Sub
Sub TotalSort()
Dim m As Long
m = Range("F" & Rows.Count).End(xlUp).Row
Range("F3:F" & m).Sort Key1:=Range("F3"), Header:=xlYes
MsgBox "Total column sorted", vbInformation
End Sub