forcing UDF to run

S

Stefi

Hi All,

I have a very simple UDF returning the address of the selected cell:

Public Function AktCell() As String
AktCell = ActiveCell.Address(False, False)
End Function

It works fine when I newly insert it in a cell, but doesn't refresh the cell
when I select another cell despite I have a Calculation line a
Selection_change event!

How can I force the UDF to run when selecting a new cell?

Thanks,
Stefi
 
P

Peo Sjoblom

Add this

application.volatile

--
Regards,

Peo Sjoblom

(No private emails please)
 
B

Bob Phillips

There is nothing in the function that forces a recalculation of the
function. Even if you put Application.Volatile in there it will only
recalculate when you have something that forces a sheet
recalculation.selecting another cell does not do that

You can do it with an event procedure


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("showactive").Value = Target.Address(False, False)
End Sub

where showactive is the name of a cell to show the active cell address

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Top