J
Jim A
I am trying to find a function that will retrieve a worksheet name if the MAX
function retrieves a number from that work sheet. Any Ideas?
function retrieves a number from that work sheet. Any Ideas?
I am trying to find a function that will retrieve a worksheet name if the MAX
function retrieves a number from that work sheet. Any Ideas?
Gary''s Student said:This is only an example, but you can adapt it for your use:
Say we have a workbook with three worksheets: Sheet1, Sheet, and Sheet3.
Say we have defined some Named Ranges on the sheets:
first for Sheet1!A13
second for Sheet2!A13
third for Sheet3!A13
anywhere in the workbook we enter:
=MAX(first,second,third)
and see displayed 27 (because B2 on Sheet3 contains 27 and it's the max
across the three sheets)
....Enter this UDF:
....And =whatsheet(27,first,second,third) will return Sheet3
To find out which cell has the 27, enter and use:
Function whatcell(v As Variant, r1 As Range, r2 As Range, r3 As Range) As String ....
For Each r In r1
If r.Value = v Then
whatcell = r.Address
Exit Function
End If
Next