Last active
August 10, 2019 20:19
-
-
Save luane-aquino/f84d2a48d03611616ecdf85dff624baa to your computer and use it in GitHub Desktop.
Highlight every other row of current selection - LibreOffice/OpenOffice Calc macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 1- on LibreOffice Calc, select a range of cells | |
' 2- run the macro below | |
Sub HighlightRangeMacro() | |
Dim nCol As Long 'Column index variable | |
Dim nRow As Long 'Row index variable | |
Dim oCols 'Columns in the selected range | |
Dim oRows 'Rows in the selected range | |
Dim oRange | |
Const nCellBackColor = 15132415 ' "Blue gray" | |
oRange = ThisComponent.getCurrentSelection() | |
oCols = oRange.Columns : oRows = oRange.Rows | |
For nCol = 0 To oCols.getCount() - 1 | |
For nRow = 0 To oRows.getCount() - 1 Step 2 | |
oRange.getCellByPosition(nCol, nRow).setPropertyValue("CellBackColor", nCellBackColor) | |
Next | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment