I am new to using macros and have been using the record macro feature to try to help but I can not figure out how to modify what excel recorded into what I would like to do.
The issue is I do not know how to change the range because column J will not always end at J20, the real file I need to use this on varies but it typically ends at J320000. Is there a way to set the range until there are no more values in a cell within that column. Any help would really be appreciated.
Code:
Sub Macro13()
'
' Macro13 Macro
'
'
Range("J2:J20").Select
ActiveWorkbook.Worksheets("Calculator").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Calculator").Sort.SortFields.Add Key:=Range("J9") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Calculator").Sort
.SetRange Range("J2:J20")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
The issue is I do not know how to change the range because column J will not always end at J20, the real file I need to use this on varies but it typically ends at J320000. Is there a way to set the range until there are no more values in a cell within that column. Any help would really be appreciated.