#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default Update cell

Hello,

I have this formula in a cell:

="Summary for " & VLOOKUP(UserName(),'Sheet1'!B34:C100,2,FALSE)

The UserName() Function is this, which is in a seperate module:

Function UserName() As String
UserName = Environ("UserName")
End Function


The problem is when the user opens the file the formula doesnt work. I have
tried ActiveSheet.calulcate or a macro to re-enter the formula but it doesnt
work. The only way it works is for the user to click in the cell and press
enter, then it updates with the correct username.

Does anyone know how to programatically fix this?

Many thanks in advance.

Martin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Update cell

On 22 Jan, 11:31, Martin wrote:
Hello,

I have this formula in a cell: *

="Summary for " & VLOOKUP(UserName(),'Sheet1'!B34:C100,2,FALSE)

The UserName() Function is this, which is in a seperate module:

Function UserName() As String
* UserName = Environ("UserName")
End Function

The problem is when the user opens the file the formula doesnt work. *I have
tried ActiveSheet.calulcate or a macro to re-enter the formula but it doesnt
work. *The only way it works is for the user to click in the cell and press
enter, then it updates with the correct username.

Does anyone know how to programatically fix this?

Many thanks in advance.

Martin


One solution, 'though possibly not the one you were looking for, is to
discard your function and use the Workbook_Open event instead to write
the user name to a cell on a worksheet. Then use the worksheet
reference in your lookup rather than the function.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Update cell

Hi Martin,

Add 'Application.Volatile' to your function.
Or use NOW() as a dummy argument

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Martin" wrote in message
...
Hello,

I have this formula in a cell:

="Summary for " & VLOOKUP(UserName(),'Sheet1'!B34:C100,2,FALSE)

The UserName() Function is this, which is in a seperate module:

Function UserName() As String
UserName = Environ("UserName")
End Function


The problem is when the user opens the file the formula doesnt work. I
have
tried ActiveSheet.calulcate or a macro to re-enter the formula but it
doesnt
work. The only way it works is for the user to click in the cell and
press
enter, then it updates with the correct username.

Does anyone know how to programatically fix this?

Many thanks in advance.

Martin


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Update cell

Another way, without VBA

Define this name

Name user
Refersto =GET.WORKSPACE(26)&IF(NOW(),"","")

and in your cell simply
="Summary for " & user

Regards,
Peter T


"Martin" wrote in message
...
Hello,

I have this formula in a cell:

="Summary for " & VLOOKUP(UserName(),'Sheet1'!B34:C100,2,FALSE)

The UserName() Function is this, which is in a seperate module:

Function UserName() As String
UserName = Environ("UserName")
End Function


The problem is when the user opens the file the formula doesnt work. I
have
tried ActiveSheet.calulcate or a macro to re-enter the formula but it
doesnt
work. The only way it works is for the user to click in the cell and
press
enter, then it updates with the correct username.

Does anyone know how to programatically fix this?

Many thanks in advance.

Martin



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation lists update orginal cell with list update [email protected] Excel Worksheet Functions 3 July 11th 08 07:56 AM
Update Excel cell in formula not refreshing answer cell Johnny Excel Discussion (Misc queries) 2 June 21st 07 05:49 AM
auto-hide rows, cell format (# and @), update cell refs, shade cel Mo2 Excel Discussion (Misc queries) 0 April 17th 07 03:44 AM
Populating Last Saved Date in Cell AND also update that same cell in Header o0o_Bigs_o0o Excel Discussion (Misc queries) 2 July 4th 06 12:56 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 05:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"