Created
January 30, 2012 20:18
-
-
Save precious/1706425 to your computer and use it in GitHub Desktop.
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
REM ***** BASIC ***** | |
Option Explicit | |
Sub Main | |
Dim oDocument | |
Dim oSelectedCells | |
Dim oActiveCells | |
Dim oSheet | |
Dim oTargetCell | |
Dim nRow | |
Dim nCol | |
Dim dValue | |
oDocument = ThisComponent | |
oSelectedCells = oDocument.CurrentSelection | |
oActiveCells = oSelectedCells.RangeAddress | |
oSheet = oDocument.Sheets.getByIndex(oActiveCells.Sheet) ' active table | |
oTargetCell = oSheet.getCellByPosition(oActiveCells.StartColumn,oActiveCells.StartRow) | |
' excluding first row which contains target cell | |
For nRow = oActiveCells.StartRow + 1 To oActiveCells.EndRow | |
For nCol = oActiveCells.StartColumn To oActiveCells.EndColumn | |
dValue = oTargetCell.getValue() | |
oSheet.getCellByPosition(nCol,nRow).setValue(dValue) | |
oDocument.calculate() | |
Next | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment