OpenOffice.org 総合相談所 (俺に訊け パート2)at BSOFT
OpenOffice.org 総合相談所 (俺に訊け パート2) - 暇つぶし2ch154:名無しさん@そうだ選挙にいこう
05/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



次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch