View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.charting
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Chart Title Using Autofilter Selection

Hi,

I think you will need a VBA solution to this one.

Try this in a standard code module,

Public Function UDFMYCRITERIA(Data As Range) As Variant
'
' Return first visible cell contents
'
Dim rngCell As Range

On Error GoTo ErrUDF

For Each rngCell In Data.Cells
If rngCell.Height 0 Then
UDFMYCRITERIA = rngCell.Value
Exit Function
End If
Next
ErrUDF:
UDFMYCRITERIA = ""
Exit Function
End Function

Then the formula in the cell used to hold the chart title would be

=UDFMYCRITERIA(A2:A200)

where A2:A200 is the column containing information to be displayed.

Cheers
Andy

wrote:
That was my first thought, I would just tie it to a cell, no problem.
However, when I click on the autofilter dropdown box and choose a
different name to filter the list the displayed name changes but the
cell reference stays the same. I need the title to display the same
name as the filter criteria. Is there a way to construct a UDF that
ties to the currently applied autofilter? If so then I could go that
route.

Andy Pope wrote:

Hi,

Use a cell to construct the required title text and the link the chart
title box to the cell.
http://www.andypope.info/tips/tip001.htm

Cheers
Andy

Roger wrote:

I have a simple line chart based on the the data displyed from using
Autofilter. I select only one criteria at time to display. I want to link
the chart title to the filtered criteria. So when I choose a different
filter the chart title will change to the new filter. Is there an easy way
to accomplish this?

Thanks,

Roger

BTW, I have both XL 2003 & XL 2007.



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info