pouvez-vous m'aider à adapter cette macro Excel pour LibreOffice ?
Dans le fichier Excel ci-joint, il y a 3 onglets.
Onglet "Entrée" où je mets les données à traiter (avec bouton de lancement de macro).
Onglet "Adresses" où je mets login, mdp
Onglet "Sortie" où j'obtiens le résultat de la macro. Login, mdp, mail
Merci par avance
Macro Excel
Code : Tout sélectionner
Public Sub NormalizeData()
Dim n As Long, I As Long, k As Long
Dim tmp, arr(), r
With Worksheets("Entrée")
n = .Cells(.Rows.Count, 1).End(xlUp).Row
For I = 3 To n Step 8
tmp = Split(Trim(.Cells(I, 1)), "|")
ReDim Preserve arr(2, k + 1)
arr(0, k) = Trim(Split(tmp(0), ":")(1))
arr(1, k) = Trim(Split(tmp(1), ":")(1))
k = k + 1
Next I
End With
With Worksheets("Adresses")
ActiveWorkbook.Names.Add Name:="Liste", RefersTo:=.Cells(1).CurrentRegion
End With
With Worksheets("Sortie")
.Cells(1).CurrentRegion.Offset(1).Clear
.Cells(2, 1).Resize(UBound(arr, 2), 2).Value = Application.Transpose(arr)
n = .Cells(.Rows.Count, 1).End(xlUp).Row
For I = 2 To n
r = Application.VLookup(.Cells(I, 1), [Liste], 2, False)
If IsError(r) Then
.Cells(I, 3) = "NC"
Else
.Cells(I, 3) = r
.Hyperlinks.Add anchor:=.Cells(I, 3), _
Address:="mailto:" & .Cells(I, 3)
End If
Next
.Activate
End With
Erase arr
End Sub