Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Main
- oSels = ThisComponent.CurrentSelection
- myRanges = ThisComponent.createInstance("com.sun.star.sheet.SheetCellRanges")
- oView = ThisComponent.getCurrentController()
- oSheet = oView.getActiveSheet()
- If oSels.getImplementationName() = "ScCellRangesObj" Then
- For selIndex = 0 to oSels.getCount() - 1
- oSel = oSels.getByIndex(selIndex)
- parts = Split(oSel.AbsoluteName,".")
- part = parts(UBound(parts))
- part = Replace(part,"$","")
- rg = oSheet.getCellRangeByName(part)
- myRanges.addRangeAddress(rg.getRangeAddress(), False)
- MsgBox part
- Next selIndex
- Else
- Dim oConv as Object
- oConv = ThisComponent.createInstance("com.sun.star.table.CellRangeAddressConversion")
- oConv.Address = oSels.getRangeAddress
- MsgBox oConv.UserInterfaceRepresentation
- rg = oSheet.getCellRangeByName(oConv.UserInterfaceRepresentation)
- myRanges.addRangeAddress(rg.getRangeAddress(), False)
- End If
- REM abaixo aplicaremos a acao desejada ao(s) intervalo(s) selecionado(s)
- for each rg in myRanges()
- For i = 0 To rg.Rows.getCount() - 1
- For j = 0 To rg.Columns.getCount() - 1
- oCell = rg.getCellByPosition( j, i )
- oCell.String = "oi"
- Next j
- Next i
- next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment