PC Review


Reply
Thread Tools Rate Thread

Copy name of filtered cell to another worksheet

 
 
erick-flores
Guest
Posts: n/a
 
      10th Sep 2007
Hello all

This is the scenario:
WorksheetA - have an autofielter
WorksheetB - one to get the autofiltered name from the WorksheetA

WorksheetA - Business Name = Dell
WorksheetB - C3= 'WorksheetA'!A2 This means C3=Dell

BUT if I change the filtering in WorksheetA - Business Name =
Microsoft
my WorksheetB still showing the "Dell" name...I can tell the cell in
WB is not changing as my data change in WA. My question is: how can I
make this dynamically so my cell in WB change as my filter changes?

Thanks

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      11th Sep 2007
Can you use the criteria for that column?

If yes...

This is from a Tom Ogilvy post:

http://j-walk.com/ss/excel/usertips/tip044.htm

to get it to refresh:

=FilterCriteria(B5)&left(Subtotal(9,B5:B200),0)


this is one I wrote back in 2000

Here is a user defined function that will display the criteria in a cell:

Public Function ShowFilter(rng As Range)
Dim filt As Filter
Dim sCrit1 As String
Dim sCrit2 As String
Dim sop As String
Dim lngOp As Long
Dim lngOff As Long
Dim frng As Range
Dim sh As Worksheet
Set sh = rng.Parent
If sh.FilterMode = False Then
ShowFilter = "No Active Filter"
Exit Function
End If
Set frng = sh.AutoFilter.Range

If Intersect(rng.EntireColumn, frng) Is Nothing Then
ShowFilter = CVErr(xlErrRef)
Else
lngOff = rng.Column - frng.Columns(1).Column + 1
If Not sh.AutoFilter.Filters(lngOff).On Then
ShowFilter = "No Conditions"
Else
Set filt = sh.AutoFilter.Filters(lngOff)
On Error Resume Next
sCrit1 = filt.Criteria1
sCrit2 = filt.Criteria2
lngOp = filt.Operator
If lngOp = xlAnd Then
sop = " And "
ElseIf lngOp = xlOr Then
sop = " or "
Else
sop = ""
End If
ShowFilter = sCrit1 & sop & sCrit2
End If
End If
End Function

=ShowFilter(B5)&left(Subtotal(9,B5:B200),0)

would show the filter for column 2

I usually put these functions in cells above the filter

==============
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

erick-flores wrote:
>
> Hello all
>
> This is the scenario:
> WorksheetA - have an autofielter
> WorksheetB - one to get the autofiltered name from the WorksheetA
>
> WorksheetA - Business Name = Dell
> WorksheetB - C3= 'WorksheetA'!A2 This means C3=Dell
>
> BUT if I change the filtering in WorksheetA - Business Name =
> Microsoft
> my WorksheetB still showing the "Dell" name...I can tell the cell in
> WB is not changing as my data change in WA. My question is: how can I
> make this dynamically so my cell in WB change as my filter changes?
>
> Thanks


--

Dave Peterson
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return filtered values into report worksheet based on filtered valueon the data worksheet dicko1 Microsoft Excel Worksheet Functions 1 21st Apr 2009 12:27 AM
SELECT THE FIRST CELL IN ADVANCE FILTERed worksheet vba code =?Utf-8?B?Q21L?= Microsoft Excel Programming 2 10th Jun 2007 12:53 PM
How do I copy a filtered subset of data to another worksheet? =?Utf-8?B?c2Z0d3Jxbg==?= Microsoft Excel Misc 2 30th Jun 2005 02:17 PM
Copy filtered rows to a new worksheet Richmont Microsoft Excel Programming 1 19th Apr 2004 06:34 PM
Copy from a Filtered List in aanother worksheet Frederick Microsoft Excel Misc 2 10th Aug 2003 08:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:26 AM.