Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to Modify Worksheet Range when called by a UDF

Hi,

I have been spinning my wheels trying to figure out how to solve my problem.
I am not sure if using a UDF is the correct solution. I have read that UDF
cannot modify worksheets if they are called in a certain way, but can if they
are called another way. I have read about Excel Addins, COM Addins and UDFs
and feel confused on which of these will provide the solution.

What I want to do is provide a funtion that a user can use that will take in
parameters, and then return the result by modifing a range of cells. One of
the parameters passed in will be the starting cell for the resulting range.

I need to write most of this code (if not all) in C# (VB.NET). We are
trying to limit the amount of VBA code that we need in our solution.

Being pointed in the right direction is greatly appreciated.

Michael

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How to Modify Worksheet Range when called by a UDF

The question is how is the function called.
If the function is called by adding a formula to a cell then it can only
modify the value of the cell that it is in. Similar to any function in XL
such as sum or average it's scope is limited to the cell that it is in.
If however the function is called using a command button or event then a
function has free reign to do whatever it wants to any number of cells in any
number of sheets.
--
HTH...

Jim Thomlinson


"Michael Franz" wrote:

Hi,

I have been spinning my wheels trying to figure out how to solve my problem.
I am not sure if using a UDF is the correct solution. I have read that UDF
cannot modify worksheets if they are called in a certain way, but can if they
are called another way. I have read about Excel Addins, COM Addins and UDFs
and feel confused on which of these will provide the solution.

What I want to do is provide a funtion that a user can use that will take in
parameters, and then return the result by modifing a range of cells. One of
the parameters passed in will be the starting cell for the resulting range.

I need to write most of this code (if not all) in C# (VB.NET). We are
trying to limit the amount of VBA code that we need in our solution.

Being pointed in the right direction is greatly appreciated.

Michael

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to Modify Worksheet Range when called by a UDF

Jim,

Does wrapping the UDF in VBA also give it the ability to do whatever it wants?

Would an RTD server also be able to do whatever it wants?

Thanks

Michael
"Jim Thomlinson" wrote:

The question is how is the function called.
If the function is called by adding a formula to a cell then it can only
modify the value of the cell that it is in. Similar to any function in XL
such as sum or average it's scope is limited to the cell that it is in.
If however the function is called using a command button or event then a
function has free reign to do whatever it wants to any number of cells in any
number of sheets.
--
HTH...

Jim Thomlinson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open worksheet when called through a function zoddiax Excel Programming 3 August 3rd 07 04:18 AM
add and remove rows from a called range Buddy Lee Excel Programming 3 October 2nd 05 03:37 PM
range.find method called into a VBA function (problem) Eros Pedrini Excel Programming 5 November 17th 04 12:34 PM
function called from worksheet and bad result! @lan Excel Programming 6 August 3rd 04 03:12 PM
Keeping name of worksheet who called macro Dkline[_2_] Excel Programming 3 January 30th 04 06:40 PM


All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"