ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   #Name? Error in place of function result (https://www.excelbanter.com/excel-programming/389749-name-error-place-function-result.html)

Larry Serflaten

#Name? Error in place of function result
 
New to Excel VBA, old hand at VB, I am having trouble
calling a function from a cell.

What I want to do is update a cell every 2 minutes, where
I plan to use the OnTime method. So I added a function to
the sheet code module but it didn't work there. I then added
a separate module (Module1) and tried it there, but I still get
the #Name? as a response.

It seems the function is not visible from the cell.

What are the steps involved in creating a function that will
be callable from a cell, and, what topic in Help discusses
that task (I couldn't find anything relavent)

LFS



Gary''s Student

#Name? Error in place of function result
 
How have you coded the function and how are you using it in the cell?
--
Gary''s Student - gsnu200723


"Larry Serflaten" wrote:

New to Excel VBA, old hand at VB, I am having trouble
calling a function from a cell.

What I want to do is update a cell every 2 minutes, where
I plan to use the OnTime method. So I added a function to
the sheet code module but it didn't work there. I then added
a separate module (Module1) and tried it there, but I still get
the #Name? as a response.

It seems the function is not visible from the cell.

What are the steps involved in creating a function that will
be callable from a cell, and, what topic in Help discusses
that task (I couldn't find anything relavent)

LFS




Larry Serflaten

#Name? Error in place of function result
 

"Gary''s Student" wrote
How have you coded the function and how are you using it in the cell?
--
It seems the function is not visible from the cell.


The function is declared in a module like:

Public Function ChangingMessage()
.. code to build message
End Function

And I am trying to call it up from a cell like this:

=ChangingMessage()


But, as I said, what shows in the cell is "#Name?" (or something
similar)

LFS



Niek Otten

#Name? Error in place of function result
 
If it had the same Function name when you tried in a Sheet Module, you get the #NAME error.
Try with a new name.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Larry Serflaten" wrote in message ...
|
| "Gary''s Student" wrote
| How have you coded the function and how are you using it in the cell?
| --
| It seems the function is not visible from the cell.
|
|
| The function is declared in a module like:
|
| Public Function ChangingMessage()
| .. code to build message
| End Function
|
| And I am trying to call it up from a cell like this:
|
| =ChangingMessage()
|
|
| But, as I said, what shows in the cell is "#Name?" (or something
| similar)
|
| LFS
|
|




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

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