Search code examples
vbalibreofficelibreoffice-calc

Get row number of a FindFirst result in VBA Libreoffice


I have a function finding the first cell in a column containing a value:

recherche = colonneRecherche.createSearchDescriptor    
    with recherche                     
        .SearchString = valeur
        .SearchCaseSensitive = false    
        .SearchByRow = true          
        .SearchWords = false          
    end with
resultat = colonneRecherche.findFirst(recherche)
    if isnull(resultat) then
        RechercherValeur = "NO RESULT!"
        Exit Function
    else
        thisComponent.CurrentController.select(resultat)
        a.nom = "TEST"
        RechercherValeur = a
        Exit Function
    End If

The line containing "select" selects the good cell, but I'd like to get the row number of the cell without selecting it. I tried

resultat.Row

But it doesn't work. Can anyone help me please? Thanks


Solution

  • I found it by myself:

    Msgbox "Row: " + resultat.cellAddress.Row