Assigning AutoFiltered Range to Range Object
Hi Simon
I hit a similar problem some long while back.
I'm not sure this is the efficient way to do it, but it got me around the
problem and i have persisted with it since.
With wss having been set as the relevant sheet, and rng1 and rng2 dimmed as
ranges
Set rng1 = wss.AutoFilter.Range.Columns(1).Cells
Set rng1 = rng1.Offset(1, 0).Resize(rng1.Rows.Count - 1, 1)
Set rng2 = rng1.SpecialCells(xlVisible)
--
Regards
Roger Govier
"Simon" wrote in message
...
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
|