ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic macro parameters (https://www.excelbanter.com/excel-programming/297197-dynamic-macro-parameters.html)

Derek[_6_]

Dynamic macro parameters
 
When calling an add-in function from a worksheet, is
there a way to make the parameter change when a row is
inserted or deleted? In other words, I have a function
that receives an argument that is a row number. If the
row number changes, I want my argument to automatically
change. The built-in functions do this, but I have not
been able to figure out how to make my functions do
this. If I use Row(A37) as the argument, it works great,
however, I only want to pass the row number not use a
built-in function as a filter.

Frank Kabel

Dynamic macro parameters
 
Hi
the function parameter will only change if you use a reference as
parameter. e.g.
your_function(A1)
or
your_function(ROW(1:1))

no chance with
your_function(1)
as Excel does not know that your '1' represents a row number


--
Regards
Frank Kabel
Frankfurt, Germany


Derek wrote:
When calling an add-in function from a worksheet, is
there a way to make the parameter change when a row is
inserted or deleted? In other words, I have a function
that receives an argument that is a row number. If the
row number changes, I want my argument to automatically
change. The built-in functions do this, but I have not
been able to figure out how to make my functions do
this. If I use Row(A37) as the argument, it works great,
however, I only want to pass the row number not use a
built-in function as a filter.



Bob Phillips[_6_]

Dynamic macro parameters
 
Also there is no need to pass the row number. Pass the cell or row as a
range and extract the row number in the add-in

... = rng.Row

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
the function parameter will only change if you use a reference as
parameter. e.g.
your_function(A1)
or
your_function(ROW(1:1))

no chance with
your_function(1)
as Excel does not know that your '1' represents a row number


--
Regards
Frank Kabel
Frankfurt, Germany


Derek wrote:
When calling an add-in function from a worksheet, is
there a way to make the parameter change when a row is
inserted or deleted? In other words, I have a function
that receives an argument that is a row number. If the
row number changes, I want my argument to automatically
change. The built-in functions do this, but I have not
been able to figure out how to make my functions do
this. If I use Row(A37) as the argument, it works great,
however, I only want to pass the row number not use a
built-in function as a filter.






All times are GMT +1. The time now is 01:56 PM.

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