Hello. I need to swap the content of two cells. In this thread, the following code was suggested:
Sub swap_values()
doc = ThisComponent
sel = doc.CurrentSelection
If sel(0).ImplementationName = "ScCellObj" Then
c1 = sel(0)
c2 = sel(1)
Else
If sel(0).Columns.Count = 2 Then
c1 = sel(0).getCellByPosition(0,0)
c2 = sel(0).getCellByPosition(1,0)
Else
c1 = sel(0).getCellByPosition(0,0)
c2 = sel(0).getCellByPosition(0,1)
End If
End If
tmp = c1.String
c1.String = c2.String
c2.String = tmp
End Sub
The problem is this macro only swaps the text between the cells. Please how to modify it so that it swaps the style (background color, font color) each cell has as well?