+ Reply to Thread
Results 1 to 4 of 4

Recalculate cell with UDF

  1. #1
    Numfric
    Guest

    Recalculate cell with UDF

    I have a cell with the following contents:
    =CONCATENATE("Last updated ",TEXT(LastSaved(), "mmmm dd, yyyy"))

    LastSaved is a UDF with the following definition:

    Public Function LastSaved()
    LastSaved = ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")
    End Function

    I have automatic recalc turned on. If I save the workbook, exit and bring
    it up again, the cell value still shows the previous last saved date. If I
    F2 on the cell and press Enter, the date is refreshed with the current date.
    What's going on?

  2. #2
    Arvi Laanemets
    Guest

    Re: Recalculate cell with UDF

    Hi

    Try this:
    =IF(NOW()>0,"Last updated " & TEXT(LastSaved(), "mmmm dd, yyyy"))

    Arvi Laanemets


    "Numfric" <[email protected]> wrote in message
    news:[email protected]...
    > I have a cell with the following contents:
    > =CONCATENATE("Last updated ",TEXT(LastSaved(), "mmmm dd, yyyy"))
    >
    > LastSaved is a UDF with the following definition:
    >
    > Public Function LastSaved()
    > LastSaved = ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")
    > End Function
    >
    > I have automatic recalc turned on. If I save the workbook, exit and bring
    > it up again, the cell value still shows the previous last saved date. If

    I
    > F2 on the cell and press Enter, the date is refreshed with the current

    date.
    > What's going on?




  3. #3
    Oliver Ferns via OfficeKB.com
    Guest

    Re: Recalculate cell with UDF

    Try putting

    Application.Volatile True

    In your UDF.

    Hth,
    Oli

    --
    Message posted via http://www.officekb.com

  4. #4
    Numfric
    Guest

    Re: Recalculate cell with UDF

    Thank you both for your responses. Both methods work. I went with
    Application.Volatile (True is implied), as there is less clutter in the cell.

    "Oliver Ferns via OfficeKB.com" wrote:

    > Try putting
    >
    > Application.Volatile True
    >
    > In your UDF.
    >
    > Hth,
    > Oli
    >
    > --
    > Message posted via http://www.officekb.com
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1