How can I get an Integer like =column(ref) (ref passed as a parameter) inside of an user-defined Function?
And =column() (the numeric value of the column where I use the function)?
How can I get an Integer like =column(ref) (ref passed as a parameter) inside of an user-defined Function?
And =column() (the numeric value of the column where I use the function)?
Hallo
=COLUMN()
without Arguments returns Column-number from Cell with Function.
=COLUMN( CellReferenz )
returns Columnnumber from referenced Cell.
Thanks Karolus,
aber =COLUMN() nor =COLUMN( CellReferenz ) doesn’t work for me inside a macro Function
EG
Function TMES(Fecha As Date, VV) As String
Dim Ndia As Integer, Nmes As Integer, ddd As String, Nfecha, doif As Integer, ThisC As Integer
doif = COLUMN()- COLUMN(VV)
get an error sub procedure not defined
Hi - You can pass the column like this: =MYFUNCTION(C1;COLUMN())
Example: ColInFunction.ods
Function MYFUNCTION(Val1, Val2) AS long
MYFUNCTION = Val1 - Val2
End function
Thanks, Pierre-Yves.
Now it is possible to me to pass column() as parameter in (for example Val2) .
Few years without spreadshets programming was very bad for me. Thanks again
The parameters of a custom function in Calc are always passed by value if the function was called by the evaluator which is the object in charge of evaluating expressions contained in cells. The function body neither has access to the cells referenced by parameters nor to the cell the function was called from. Only the evaluator will know where to return the result to.
In addition: To get access to Calc functions from custom function code you need to create an access object with the help of the proper uno service first. Read Andrew Pitonyak’s book and informations pages. You can get these documents (odt or pdf) from this site.
Calling COLUMN() this way should return the result for the active selection and not for the column the evaluator called the function from. (These may be the same, of course, under specific circumstances.)
Thaks Lupp. I’ll read it