Thread: code help cont.
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default code help cont.

Your code tells it to only use column B. Tell it to use the whole table:
Sheets("Stepdown").Select
range("B1").CurrentRegion.AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Worksheets("Stepdown2") _
.Range("A1"), Unique:=True

Obviously I can't see your sheet or know how your data is laid out. so you
substitute in the best way to get the "table" or what you want treated as a
table.

However, note that if you only want rows that are unique with respect to
column B, then you would need to filter in place, then copy

Dim rng as Range, rng1 as Range
Sheets("Stepdown").Select
Columns("B:B").AdvancedFilter _
Action:=xlFilterInPlace, _
Unique:=True
set rng = Columns("B:B").SpecialCells(xlVisible)
set rng1 = Intersect(Range("b1").CurrentRegion, rng.Entirerow)
rng1.copy Destination:=Worksheets("Stepdown2") _
.Range("A1")



--
Regards,
Tom Ogilvy




"scrabtree" wrote in message
...
Sheets("Stepdown").Select
Columns("B:B").AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Worksheets("Stepdown2") _
.Range("A1"), Unique:=True


This only copied Column B:B to the Stepdown2 sheet. I
wanted the whole table copied not just column B:B?