G
Gisela
I'm new in macro programming and it is not sorting. Can someone help me?
This is the code:
SortData:
'Sort Data worksheet
Dim myrange As Range
Dim LastRow As Variant
Worksheets("Data").Select
'Establish range for sort
'Get the last row of worksheet Data
LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
Set myrange = Range("B10:S" & LastRow)
'Sorts ascending by Section ID ("H10")
With myrange
.Sort Key1:=Range("H10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
This is the code:
SortData:
'Sort Data worksheet
Dim myrange As Range
Dim LastRow As Variant
Worksheets("Data").Select
'Establish range for sort
'Get the last row of worksheet Data
LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
Set myrange = Range("B10:S" & LastRow)
'Sorts ascending by Section ID ("H10")
With myrange
.Sort Key1:=Range("H10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With