ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Function not refreshing (https://www.excelbanter.com/excel-programming/320793-worksheet-function-not-refreshing.html)

Mark

Worksheet Function not refreshing
 
I have a excel file which is used by several people and I wanted it to show
who was using it at the moment so I wrote

Public Function CurrUserName(Workbook) As String
CurrUserName = Application.UserName
End Function

This does work but is only updated when someone clicks inside the cell and
then hits return.

How Can I get this to autommatically recalculate whenever someone opens the
file.
--
Cheers

Mark

Fredrik Wahlgren

Worksheet Function not refreshing
 

"Mark" wrote in message
...
I have a excel file which is used by several people and I wanted it to

show
who was using it at the moment so I wrote

Public Function CurrUserName(Workbook) As String
CurrUserName = Application.UserName
End Function

This does work but is only updated when someone clicks inside the cell and
then hits return.

How Can I get this to autommatically recalculate whenever someone opens

the
file.
--
Cheers

Mark


You need to use Appplication.Volatile

Public Function CurrUserName(Workbook) As String
Application.Volatile True
CurrUserName = Application.UserName
End Function

/Fredrik




All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com