View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
MrShorty[_26_] MrShorty[_26_] is offline
external usenet poster
 
Posts: 1
Default How to make a function change other cells in worksheet


Another reason it won't work is that Function procedures aren't allowe
to alter other cells in the way you're trying to do. The statemen
"Application.Worksheets("Sheet1").Cells(1, 1).Value = 100" is no
allowed in Function procedure, though it is a perfectly valid statemen
in a Sub procedure. A Function procedure is allowed to
1) read values. These values can either be passed to the function fro
the argument list or a statement such a
"myvar=Application.Worksheets("Sheet1").Cells( 1, 1).Value"
2) perform calculations, make decisions, and otherwise process th
information. It cannot alter cells in the worksheet or otherwise alte
the operating environment (like setting cell format properties).
3) Then return a value to the calling cell via the function name, a
you've done.

I don't know specifically what you are trying to do, but it looks lik
you either need to use a Sub procedure or use a different approach i
your Function procedure

--
MrShort
-----------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...fo&userid=2218
View this thread: http://www.excelforum.com/showthread.php?threadid=47610