View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Simon Simon is offline
external usenet poster
 
Posts: 172
Default Assigning AutoFiltered Range to Range Object

Hi,

I'm having trouble assigning an AutoFiltered Range of Data to a Range
Object. Here is my Code:

Sub PopulateValidationLists()
Range("ClientCells").Select
Dim theClientCode As String
Dim FilteredClients As Range
For Each Client In Range("ClientCells").Cells
Range("CustomerSolutions").AutoFilter Field:=9, Criteria1:="" &
Client.Value & ""
Set FilteredClients = Selection.AutoFilter.Range.Offset(1,
0).Resize(Selection.AutoFilter.Range.Rows.Count - 1)
Selection.AutoFilter.SpecialCells (xlCellTypeVisible)

Next
End Sub

The problem lies with this line of code:
Set FilteredClients = Selection.AutoFilter.Range.Offset(1,
0).Resize(Selection.AutoFilter.Range.Rows.Count - 1)
Selection.AutoFilter.SpecialCells (xlCellTypeVisible)

The error I receive is:
Object Required

Any ideas on how I can get around this?

Thanks.
Simon