OpenOffice.org 総合相談所 (俺に訊け パート2)
■ このスレッドは過去ログ倉庫に格納されています
0154名無しさん@そうだ選挙にいこう
2005/12/05(月) 21:35:17エラーがあったら各自で修正して。
sub AddValueToSelectedCells(modify)
dim oCellRange, oRangeArry, oCellEnum, oCell, row, col
oCellRange = ThisComponent.getCurrentController().getSelection()
select case oCellRange.getImplementationName()
case "ScCellObj" '単一セル選択
oCellRange.Value = oCellRange.Value + modify
case "ScCellRangeObj" '矩形選択
oRangeArry = oCellRange.getRangeAddress()
for row = 0 to oRangeArry.EndRow - oRangeArry.StartRow
for col = 0 to oRangeArry.EndColumn - oRangeArry.StartColumn
oCell = oCellRange.getCellByPosition(col, row)
oCell.Value = oCell.Value + modify
next col
next row
case "ScCellRangesObj" '不定形選択
oRangeArry = oCellRange.getCells()
oCellEnum = oRangeArry.createEnumeration()
do while oCellEnum.hasMoreElements()
oCell = oCellEnum.nextElement()
oCell.Value = oCell.Value + modify
loop
end select
end sub
■ このスレッドは過去ログ倉庫に格納されています