Sorting Data and Auto protect sheet

preview_player
Показать описание
ការប្រ់ប្រាស់បូតុងសតទិន្នន័យតាមអក្ខរក្រមៈ
YouTube Channel

Code Sorting Data below:

Ascending()
ActiveSheet.Unprotect Password:=""
Dim total_data As Range
Dim specific_column As Range

Set total_data = Worksheets("SortData").Range("D4:J16")
Set specific_column = Worksheets("SortData").Range("G:G")

total_data.Sort Key1:=specific_column, order1:=xlAscending, Header:=xlYes
Worksheets("SortData").Cells(4, 4).Select
ActiveSheet.Protect Password:=""

End Sub
Sub Descending()
ActiveSheet.Unprotect Password:=""
Dim total_data As Range
Dim specific_column As Range

Set total_data = Worksheets("SortData").Range("D4:J16")
Set specific_column = Worksheets("SortData").Range("G:G")

total_data.Sort Key1:=specific_column, order1:=xlDescending, Header:=xlYes
Worksheets("SortData").Cells(4, 4).Select
ActiveSheet.Protect Password:=""

End Sub
Рекомендации по теме