Hi,
I have some vba code that does some sorting on a predefined range like so:
Private Sub cmdStatusDateScoreSort_Click()
' Declare range to sort
Dim strSortRange As String
' Declare ranges of columns to sort by
Dim strStatusRange As String
Dim strResolveDateRange As String
Dim strScoreRange As String
' Initialise range to sort
strSortRange = "B5:U104"
' Initialise ranges of columns to sort by
strStatusRange = "D5"
strResolveDateRange = "R6"
strScoreRange = "K6"
' Sort range using Excel's range sort function
Range(strSortRange).Sort _
Key1:=Range(strStatusRange), Order1:=xlAscending, _
Key2:=Range(strResolveDateRange), Order2:=xlAscending, _
Key3:=Range(strScoreRange), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal
However, i no longer want the sort range of B5:U104 to be static as i want the user to be able to add new rows and when they click on the sort macro button, the sort picks up the newly added rows.
Can anyone help me with this?
Thanks in advance.
Bookmarks