Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Filter worksheet based on named range on alternate sheet

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Filter worksheet based on named range on alternate sheet

Try editing this one line

For Each c In ws.Range("B4:B" & iEnd).Cells


"fishy" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Filter worksheet based on named range on alternate sheet

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

"fishy" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Filter worksheet based on named range on alternate sheet

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


"fishy" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter based on named range cell - debug help required fishy Excel Programming 3 November 20th 09 01:49 PM
How to update a worksheet based on a defined named range using VB. Rambo[_4_] Excel Programming 0 March 23rd 08 07:32 AM
Filter Range on Sheet B Based on List on Sheet A Brent E Excel Discussion (Misc queries) 4 April 23rd 07 04:10 PM
Finding a named range based on cell value and copy/paste to same sheet? Simon Lloyd[_715_] Excel Programming 1 May 11th 06 11:25 PM
How Do I Do an Exclude Filter based on a Named Range? Dawg House Inc Excel Worksheet Functions 8 April 11th 06 02:49 AM


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"