I need to revise this so that it sorts the range should it increase or reduce presumably by changing the line half way down ".SetRange Range("G3:V62")" into something similar to the Range(Selection, Selection.End(xlDown)).Select command in the 2nd line
any help appreciated
ta -code below
--------------------------------
Sub Sort_by_1day()
'
' Macro1 Macro
'
'
Range("G3:AD3").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("PORT").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("PORT").Sort.SortFields.Add2 Key:=Range("m3:m3"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("PORT").Sort
.SetRange Range("G3:V62")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("G26").Select
End Sub
any help appreciated
ta -code below
--------------------------------
Sub Sort_by_1day()
'
' Macro1 Macro
'
'
Range("G3:AD3").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("PORT").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("PORT").Sort.SortFields.Add2 Key:=Range("m3:m3"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("PORT").Sort
.SetRange Range("G3:V62")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("G26").Select
End Sub