Sub TextToHyperlink() selection = ThisComponent.CurrentSelection Select Case (selection.ImplementationName) Case "ScCellObj" If (selection.String = "") Then Exit Sub End If ReplaceHyperlink(selection) Case "ScCellRangeObj" RangeReplaceHyperlink(selection.RangeAddress) Case "ScCellRangesObj" For Each address In selection.RangeAddresses RangeReplaceHyperlink(address) Next End Select End Sub Sub RangeReplaceHyperlink(ByVal address) sheet = ThisComponent.Sheets(address.Sheet) For x = address.StartColumn To address.EndColumn For y = address.StartRow To address.EndRow cell = sheet.getCellByPosition(x, y) If (cell.String = "") Then If (y = address.StartRow) Then Exit Sub Else Exit For End If End If ReplaceHyperlink(cell) Next Next End Sub Sub ReplaceHyperlink(ByVal cell) hyperlink = ThisComponent.createInstance("com.sun.star.text.TextField.URL") hyperlink.Representation = cell.String hyperlink.URL = cell.String cell.Text.insertTextContent(cell.createTextCursor(), hyperlink, True) End Sub