G
Guest
I need to select a sort range to include every row containing data, but no more. I've calculated the last row containing data using the COUNTA(A$:A$) function but how do I use this in defining the sort range
eg. the range is A7:F? where ? is the calculated number. I need this to be dynamic so that it automatically updates in the macro as each new row of data is added
This is the macro as it stands for a set range. I need the F23 value to be dynamic
Range("A7:F23").Selec
Selection.Sort Key1:=Range("A7"), Order1:=xlAscending, Key2:=Range("B7")
, Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=
xlSortNorma
Range("B2").Selec
End Sub
Thanks
Ken G.
eg. the range is A7:F? where ? is the calculated number. I need this to be dynamic so that it automatically updates in the macro as each new row of data is added
This is the macro as it stands for a set range. I need the F23 value to be dynamic
Range("A7:F23").Selec
Selection.Sort Key1:=Range("A7"), Order1:=xlAscending, Key2:=Range("B7")
, Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=
xlSortNorma
Range("B2").Selec
End Sub
Thanks
Ken G.