Hi,
I assume that using http://www.excelforum.pl/download.htm?id=69841 I could find what changes / how "range is variable"
So the first suggestion is that data is added or removed at the bottom of the range, column A has some kind of index/unique ID so is filled in every data row.
dim last_row as long
ActiveSheet.Outline.Showlevels RowLevels:=2
last_row = ActiveSheet.cells(rows.count,"A").end(xlup).row
ActiveWorkbook.Worksheet("A-L").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("L2:L" & last_row), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("K2:K" & last_row), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("J2:J" & last_row), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("I2:I" & last_row), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("H2:H" & last_row), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("A-L").Sort
.SetRange Range("A1:N" & last_row)
'...
If that's not enough, then probably my tool from the link above is not strong enough. And then I'll write basically the same as few posts above but in more open way:
Will you please attach a SMALL sample Excel workbook(s) (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).
1. Make sure that your sample data are truly REPRESENTATIVE of your real data. (If trere are typical cases like: all unique values/duplicates could occur, day/night, nobody present/several persons at once, before/on/past due, etc. - please show them all or at least indicate in text) The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.
2. Make sure that your desired solution(s) is/are also shown (mock up the results manually).
3. Make sure that all confidential/restricted information (either personal or business) like real e-mails, social security numbers, bank accounts, etc. is removed first!!
To attach an Excel file you have to do the following: Just before posting, scroll down and press Go Advanced button and then scroll down and press Manage Attachments link. Now follow the instructions at the top of that pop-up screen.
Bookmarks