Ok, again, primitive example. Within your loop you determine that you're at
the starting point (probably by row) and you know you want to include things
for sorting at a particular column.
So when you determine you are at a starting point, you could have a string
variable declared by a statement like
Dim anyRange As String
earlier in the routine. At the point where you know you are at the first
row to be sorted, and knowing you need first column to be column C, for
example, you can begin building the area to be sorted like this:
anyRange = "C" & Str(ActiveCell.Row)) & ":"
that assumes that you have actually got a cell on that row selected, but
somehow or other you know the row involved. Lets say it turns out to be row
4, then at this point, anyRange would look like C4:
You continue on until you find you're at the end of the rows to be sorted
and know that you need to sort everything on all of the rows from 4 to this
current one along with everything in cells C all the way to V, so you modify
anyRange using a statement similar to this:
anyRange= anyRange & "V" & Str(ActiveCell.Row))
If we were on row 407 then anyRange would now look like C4:V407
to prepare to sort, select that range with a statement like this
Range(anyRange).Select
and then execute your sort statement (which you probably can steal right out
of a recorded macro that performed a similar sort even if it was done on a
different group of data).
Does that help any?