View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default function to modify other cells

A function called from a worksheet cell cannot change the value of any
other cell. It can only return a value to the cell(s) from which it
was called. The reason for this limitation is that Excel must keep
track of which cells are dependent on which other cells so it can
calculate in the proper order. Excel can't determine what VBA code
might do, so it disallows code from changing other cells.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 26 Nov 2008 08:18:13 -0800, rat59man
wrote:

I am trying to write a function to modify a group of cells. As an example in
cell C1 I insert "=myfunction(1)" and in cells A1, B1, D1, E1 I want the
values of 3, 5, 7, and 11 placed.

At the assignment I get a 1004 error number returned.

My thought is that functions are not allowed to modify cells directly. Is
this correct?