Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lloyd Alvarez   on Nov 28 In MS Office Category.

  
Question Answered By: Julia Silva   on Nov 28


Where are you planning that the

BusinessResults.Range(application.caller.address).offset(rowIndex,
ColumnIndex) = 411

line should go?

It can't go inside the BusinessResults function. Nor does it have the
required parameters to allow it to be used within another function.

It's pretty unusual to return a range  from a function, anyway. What
specifically are you trying to do?

To return a range from the function, you would need a statement like

Set BusinessResults = <<< some calculation that returns a range >>>

Just reading a bit more carefully ...

> ... write an excel function  ... outputs the results to a range of cells

A function cannot output the results to a range of cells. A function
returns a single value to whatever calls it. E.g. in

Angle = Sin (2 * PI)

Sin is a function that returns a number.

If you want your routine to store information into cells, then it needs to
be a Sub, not a Function. Seeing it is a Sub, it can just set the cells
from statements within itself. You can provide the destination range as a
parameter in the call to the function if you wish.

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How does a user defined function know its cell address? Or get search suggestion and latest updates.


Tagged: