ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB: moving data range (https://www.excelbanter.com/excel-programming/340598-vbulletin-moving-data-range.html)

Greg

VB: moving data range
 
I have a list of tasks with 2 columns for peoples names. I want to assign
primary and secondary responsibilites on the list. On another sheet I want
to choose one of those names and have it find all the task to print out. I
have a macro that uses advanced filter to get the primary names. I cannot
figure out how to find the last row in the list, then move the range down to
put an advanced filter for the secondary tasks. This is what I have for a
maro now and it sorts on the task order from the first list.

Sheets("Task List").Range("A1:D161").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("B1:b2"), CopyToRange:=Range("A4:d164"),
Unique:= _
False
Range("A5:D164").Select
Selection.Sort Key1:=Range("D5"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Thanks in advance for your help


All times are GMT +1. The time now is 03:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com