Reputation: 74
I have a large no of cells in libreoffice calc, and every cell have two lines. I want to remove every first line from each cell. Any easy method? This piece of code works perfect in VBA excel but dont run in libreoffice calc.
{ Sub RemoveFirstLine(ByRef Target As Range)
Dim xCell As Range
For Each xCell In Target.Cells
xCell.Value = Right(xCell.Value, Len(xCell.Value) - InStr(1, xCell.Value, vbLf))
Next
End Sub
Sub StartRemove()
Dim xRng As Range
On Error Resume Next
Set xRng = Application.InputBox("Please select range:", "Excel 10 Tutorial", Selection.Address, , , , , 8)
If xRng Is Nothing Then Exit Sub
On Error Resume Next
RemoveFirstLine xRng
End Sub }
Upvotes: 0
Views: 282
Reputation: 2539
You don't need a macro for this task, use Find&Replace.
Press Ctrl+H or choose Edit-Find&Replace
Input to field Find .*\n, set Other Options - Regular expressions to ON, click Replace All
Upvotes: 0