Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Formula Possibility

Status
Not open for further replies.

TopJack

Programmer
Mar 10, 2001
153
GB
Is it possible to have a custom function that not only updates its own cell but another cell aswell in (Excel XP)?

This example code does not work .......

Code:
Function function_test() As Boolean

function_test = True

Range("A1").Value = "Function Has Worked"

End Function

The code returns a "#VALUE!" error because of the "Value" update statement that is presumably not allowed.

I guess this type of update is against the theory of what functions are used for. The reason for this type of user defined function is to minimise the number of formulas in a spreadsheet. Is there an alternative ? or I'm I barking up the wrong tree.

Any ideas appreciated.
 
You cannot do that if you are calling from a worksheet formula; only if you call via code.

-----------
Regards,
Zack Barresse
 
User Defined Functions on a worksheet cannot affect any cell other than the one they reside in.

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thanks.

Just sometimes its good to ask a stupid question to test my thought process. You have stopped me going down the wrong avenue.

Cheers.
 
Not stupid at all TopJack. :)

-----------
Regards,
Zack Barresse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top