triplel1977
New Member
- Joined
- Oct 12, 2008
- Messages
- 23
I am a newbie in macros, so I am basically using the recorder to create them.
I am dipping my fingers into editing, so my current problem is, how to edit the code so, regardless of the number of rows in a column it will sort all of them.
If I am reading the code correctly, he sample below says the range is going to sort to row N30, but next week I may have 150 rows. How do I write it for relative versus absolute (did I get that verbiage right?)
Thanks in advance.
Sample
ActiveWorkbook.Worksheets("BICSI_Billing").Sort.SortFields.Add Key:=Range( _
"N2:N30"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("BICSI_Billing").Sort
.SetRange Range("A1:W30")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
I am dipping my fingers into editing, so my current problem is, how to edit the code so, regardless of the number of rows in a column it will sort all of them.
If I am reading the code correctly, he sample below says the range is going to sort to row N30, but next week I may have 150 rows. How do I write it for relative versus absolute (did I get that verbiage right?)
Thanks in advance.
Sample
ActiveWorkbook.Worksheets("BICSI_Billing").Sort.SortFields.Add Key:=Range( _
"N2:N30"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("BICSI_Billing").Sort
.SetRange Range("A1:W30")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With