View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Greg Greg is offline
external usenet poster
 
Posts: 331
Default 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