ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why does this statement give an error message? (https://www.excelbanter.com/excel-programming/353630-why-does-statement-give-error-message.html)

George Furnell[_2_]

Why does this statement give an error message?
 
Good day,
Could you explain to me why the statement below should produce an error
message "VALUE!"

Range("M5").Value = 5

Thank you

George

Leith Ross[_547_]

Why does this statement give an error message?
 

Hello George,

A User Defined Function can only return a value that will be displayed
in the cell the UDF is in. You can not change the values of others
cells or their formats in a UDF. Calling a macro to chage a cell's
value or format from the UDF won't work either.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=513741


George Furnell[_2_]

Why does this statement give an error message?
 
Leith, could you please explain your statement? My UDF is in the "Module1",
do you mean that I cannot change value of a cell from within the cell using
the statement below? If not, what should I do?

Kind regards
George

"Leith Ross" wrote:


Hello George,

A User Defined Function can only return a value that will be displayed
in the cell the UDF is in. You can not change the values of others
cells or their formats in a UDF. Calling a macro to chage a cell's
value or format from the UDF won't work either.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=513741




All times are GMT +1. The time now is 11:59 PM.

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