ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   C# Automation Server and named range reference (https://www.excelbanter.com/excel-programming/362222-c-automation-server-named-range-reference.html)

LJ[_3_]

C# Automation Server and named range reference
 
I created an automation server with custom functions and I want to
allow the usage of named ranges. Normally when using functions and
named ranges the cell knows which item in the named range to use. In
my automation server the named range is passed as an object array. My
function does not know which cell is making the call so how do I know
from which cell to pull the text. Am I missing a property of the range
object that figures this out or do I need to find some way to pass in
the cell from the function is being called from?

When I have a range with a single cell, I just grab the text.


LJ[_3_]

C# Automation Server and named range reference
 
Here is an example:

If my named range is 10 cells in a column (example: MyRange = a1:a10)
if I am calling the function from b3 passing in MyRange I will get the
a3 value.


NickHK

C# Automation Server and named range reference
 
Leo,
In VB, it would be something like:
Public Function RangeValue(argNamedRange As Range) As Variant
RangeValue = argNamedRange.Range("A1").Offset(Application.Calle r.Row - 1, 0)
End Function

NickHK

"LJ" wrote in message
oups.com...
Here is an example:

If my named range is 10 cells in a column (example: MyRange = a1:a10)
if I am calling the function from b3 passing in MyRange I will get the
a3 value.





All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com