Sort range must change with added lines
don't add extra line. Make your sort the exact number of lines.
get last row in your sort column. Line belwo uses column B
LastRow = cells(rows.count,"B").end(xlup).Row
set SortRange = Range("A1:F" & LastRow)
Then sort as follows
SortRange.Sort 'add the rest of your sort parameters here
"Tail Wind" wrote:
Others will be using this workbook so I need to build in the ability to add
new names (lines). I have a worksheet called "Names" and one called "Data".
The name field (defined as a group) becomes a drop down box on the Data
worksheet for easier data entry (one name may have multiple lines of data).
The problem arises when I make a macro to sort the names A - Z, the range of
the data is set to 1000 lines for future use despite the fact less than 50
lines are currently used. Sorting that many blank lines forces the 50 names
to the bottom of the list. How can I allow others the ability to use a "sort
button" yet allow for future growth?
Thanks in advance. Using Excel 2003
|