Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to open worksheet when called through a function | Excel Programming | |||
add and remove rows from a called range | Excel Programming | |||
range.find method called into a VBA function (problem) | Excel Programming | |||
function called from worksheet and bad result! | Excel Programming | |||
Keeping name of worksheet who called macro | Excel Programming |