View Single Post
  #2   Report Post  
Gary''s Student
 
Posts: n/a
Default

For the first part, enter the following UDF:

Function whereis(r As Range, v As Variant) As String
Dim rr As Range
For Each rr In r
If rr.Value = v Then
whereis = rr.Address
End If
Next
End Function

and use it like
=whereis(A:A,MAX(A:A))

where A:A can be replaced by your range.
--
Gary's Student


"Conan Kelly" wrote:

Hello all,

There are two things I'm trying to do.

First, is there a function that will return (to the cell the function
is in) the address of the maximum value in a range? I have a chart
based on months over several years. I have the last several rows of
the chart data left blank (for future input), but my chart includes
these blank months in it. I'm hoping to dynamically set the range of
the chart's source data based on the address that appears in a cell,
so the chart will only show the months that have data in them.

Second, is there a function that will extract unique values from a
list? Like Auto Filter does: When you turn Auto Filter on and click
the drop down in one of the columns, there are only unique values in
the drop down list.

If there is a way to create worksheet functions in VBA and then use
them in the cells of the worksheets, please post sample code.

Thanks for any help anyone can provide,

Conan Kelly