ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   changing cell values from within UDF (https://www.excelbanter.com/excel-programming/343109-changing-cell-values-within-udf.html)

[email protected]

changing cell values from within UDF
 
I made a UDF (so residing in a function module) and want to change the
value of a cell on "sheet1" but this doesn't work. I can read the value
but not set it. Like it was read-only. It doesn't seem to work with
other properties (e.g. colour) to

Regards
Benny


Bob Phillips[_6_]

changing cell values from within UDF
 
Benny,

A UDF can only return a result, it cannot change properties of a worksheet
or cells. The result will show in the cell that the UDF is called in but
that is it.

If you want to set colour, you could use conditional formatting based upon
the value in a cell.

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
I made a UDF (so residing in a function module) and want to change the
value of a cell on "sheet1" but this doesn't work. I can read the value
but not set it. Like it was read-only. It doesn't seem to work with
other properties (e.g. colour) to

Regards
Benny




Chip Pearson

changing cell values from within UDF
 
A function called from a worksheet cell cannot make any changes
to the Excel environment, including change the value of another
cell. It can only return a value to the which called it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
oups.com...
I made a UDF (so residing in a function module) and want to
change the
value of a cell on "sheet1" but this doesn't work. I can read
the value
but not set it. Like it was read-only. It doesn't seem to work
with
other properties (e.g. colour) to

Regards
Benny




Jeff Stevens

changing cell values from within UDF
 
UDF's are not allowed to change the structure of the worksheet. You'll have
to put the changes you want to make in a SUB module.

wrote in message
oups.com...
I made a UDF (so residing in a function module) and want to change the
value of a cell on "sheet1" but this doesn't work. I can read the value
but not set it. Like it was read-only. It doesn't seem to work with
other properties (e.g. colour) to

Regards
Benny





All times are GMT +1. The time now is 03:25 AM.

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