forcing UDF to run

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top