Filter worksheet based on named range on alternate sheet

F

fishy

I am getting a debug 'Method range of worksheet failed' for the following
macro:

Sub MyTeamFilter()
Dim c As Range
Dim ws As Worksheet
Dim iEnd As Long

UndoMyTeamFilter
Set ws = Sheets("Weekly Performance")
iEnd = ws.Range("B4").End(xlDown).Row
For Each c In ws.Range("B4:B" & iEnd)
If c >= ws.Range("[TeamFilter]") Then c.EntireRow.Hidden = True
Next c
End Sub

Teamfilter is a named range on my 'Control' worksheet.

I am trying to filter the weekly performance based on the dropdown selected
in 'TeamFilter'.

Any help would be appreciated
 
B

B Lynn B

Oh oops. You also shouldn't need the brackets around your named range in the
line:

If c >= ws.Range("[TeamFilter]") Then c.EntireRow.Hidden = True
 
F

fishy

got further but got another debug.

The named range 'Teamlist' is on the 'control' wrksheet so doesnt recognise
the lookup. when i change this to a named range on the same sheet then it
looks as if it is working and knows how many rows it should find but doesnt
filter them.

Help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top