Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default User-Defined function not working

I am trying to get a user defined functione to work in
excel and all I get is #NAME. I am using Office XP (Excel
2002)

I have simplified the function to a minimum (here is the
code):

Public Function User()
' Returns the name of the current User
User = Application.UserName
End Function


I have tried the following:

- Set Macro security to Medium and then to low.
- Digitally signed the code using a key generated by
SELFCERT.exe
- Everytime I have changed the secucrity settings I save
the spreadsheet, closed it and re-opened it.

So far nothing works can anyone offer some insight?

Thanks
..


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default User-Defined function not working

Guy,
If you are trying to put the value of this function into a cell on a sheet,
then make sure that the cell formula is

=User()

By the way, I usually prefer to name my custom functions something like
ufUser (for "User Function") just in case "User" is a reserved name in
Excel.

Salut,

Alex@JPCS


"Guy Gagnon" wrote in message
...
I am trying to get a user defined functione to work in
excel and all I get is #NAME. I am using Office XP (Excel
2002)

I have simplified the function to a minimum (here is the
code):

Public Function User()
' Returns the name of the current User
User = Application.UserName
End Function


I have tried the following:

- Set Macro security to Medium and then to low.
- Digitally signed the code using a key generated by
SELFCERT.exe
- Everytime I have changed the secucrity settings I save
the spreadsheet, closed it and re-opened it.

So far nothing works can anyone offer some insight?

Thanks
.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default User-Defined function not working

Make sure the function is in a general module and not in a worksheet module
or the ThisWorkbook module.

As long as macros are enabled, should work.


Regards,
Tom Ogilvy

Guy Gagnon wrote in message
...
I am trying to get a user defined functione to work in
excel and all I get is #NAME. I am using Office XP (Excel
2002)

I have simplified the function to a minimum (here is the
code):

Public Function User()
' Returns the name of the current User
User = Application.UserName
End Function


I have tried the following:

- Set Macro security to Medium and then to low.
- Digitally signed the code using a key generated by
SELFCERT.exe
- Everytime I have changed the secucrity settings I save
the spreadsheet, closed it and re-opened it.

So far nothing works can anyone offer some insight?

Thanks
.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default User-Defined function not working

Thanks for the tip. The problem I was having weas the
code was not in a General module rather it was in the
worksheet.

Cheers,
Guy
-----Original Message-----
Guy,
If you are trying to put the value of this function into

a cell on a sheet,
then make sure that the cell formula is

=User()

By the way, I usually prefer to name my custom functions

something like
ufUser (for "User Function") just in case "User" is a

reserved name in
Excel.

Salut,

Alex@JPCS


"Guy Gagnon" wrote in message
...
I am trying to get a user defined functione to work in
excel and all I get is #NAME. I am using Office XP

(Excel
2002)

I have simplified the function to a minimum (here is the
code):

Public Function User()
' Returns the name of the current User
User = Application.UserName
End Function


I have tried the following:

- Set Macro security to Medium and then to low.
- Digitally signed the code using a key generated by
SELFCERT.exe
- Everytime I have changed the secucrity settings I save
the spreadsheet, closed it and re-opened it.

So far nothing works can anyone offer some insight?

Thanks
.




.

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
User Defined Function is not working for me in Excel 2007 Abdi Excel Discussion (Misc queries) 1 November 18th 08 10:50 PM
User Defined function - Help makulski Excel Worksheet Functions 8 February 27th 08 09:44 PM
user defined function delmac Excel Worksheet Functions 1 August 11th 06 04:31 PM
User Defined Function Samad Excel Discussion (Misc queries) 14 November 16th 05 12:32 PM
User-defined function PierreL Excel Worksheet Functions 4 December 23rd 04 09:16 AM


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

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

About Us

"It's about Microsoft Excel"