How get value from function parameter

Hi!
I have a Function GETROLE
The usage of Function is : =GETROLE(A2)
It takes the string from the cell A2, searching the same value in other sheet and return some sting
The problem is: that I dont know how to get value(string) from CellRow, because I dont know what kind of object is sending in function. Any ideas?

Function GETROLE (CellRow As String) As String
Dim Doc As Object
Dim Sht, Cell_role, Cell_is_on, Cell_FIO, InPutFIO As Object
Dim FIO, rol as String
Doc = ThisComponent
Sht = Doc.Sheets.getByName("Роли")
MsgBox CellRow
For i = 1 to 100
	Cell_FIO =  Sht.getCellByPosition(i , 0)
	If FIO = Cell_FIO.String  Then
		For j =2 to 60
		Cell_is_on = Sht.getCellByPosition(i, j)
 		If Cell_is_on.String = "ДА" 	Then
			rol = rol  + Sht.getCellByPosition(i, j).String +"; "
		End If	 
		Next j
	End If		
Next i	
GETROLE = rol
End Function

The question is unclear. If you are using the Basic function as spreadsheet function, you should already get the data (string?) in CellRow. How CellRow is connected to FIO, which you seem to use for comparison?

Unrelated: note that in

Dim FIO, rol as String

FIO is Variant, and only rol is String. If you need them both as strings, you either need to write

Dim FIO as String, rol as String

or use DefStr, or declare them with trailing type character $.

Yes, there are some garbage in the code.
Clear one is down bellow.
I got an error in here If Cell_FIO = CellRow Then attribute is required

REM  *****  BASIC  *****
Function GETROLE (CellRow As String) As String
Dim Doc As Object
Dim Sht, Cell_role, Cell_is_on, Cell_FIO, InPutFIO As Object

Dim rol as String

Doc = ThisComponent
Sht = Doc.Sheets.getByName("Роли")

For i = 1 to 100
	Cell_FIO =  Sht.getCellByPosition(i , 0)
	
	If Cell_FIO = CellRow Then
		For j =2 to 60
		Cell_is_on = Sht.getCellByPosition(i, j)
 		If Cell_is_on.String = "ДА" 	Then
			rol = rol  + Sht.getCellByPosition(i, j).String +"; "
		End If	 
		Next j
	End If		
Next i	

GETROLE = rol
End Function

Wait, why did you change the Cell_FIO.String to simple Cell_FIO in comparison?

Because I forgot . If Cell_FIO.String = CellRow Then maks the same error. How use String from CellRow?

You seem to do something wrong - but it’s hard to tell without the sample spreadsheet. But you need to test in small steps, instead of writing it all, and then trying to find the error (maybe you use wrong indices? did you want to check columns 1 to 59 and rows 0 to 99 - and missed that they are counted from 0?).

“It’s a miracle, I can walk” in IDE I have error, in Calc it works as I want

Heh, are you trying to run the function in IDE without passing the argument there?

If you want to start if from IDE, you need a helper:

sub tst
  MsgBox GETROLE("ИванИваныч")
end sub

That is it! Thanks

A hint: there’s https://forumooo.ru/, and LibreOfficeRU Telegram channel.