openoffice calc basic delete row based on criteria
Sección: Programación
Creado: 22-12-24 (Actualizado: 26-10-18)
Sub DeleteApples
oSheet=thiscomponent.getcurrentcontroller.activesheet
' This routine assumes a single column range contains the values to be checked for row deletion
oRows = ThisComponent.CurrentController.ActiveSheet.Rows
nCol = oRange.getRangeAddress.StartColumn
for nRow = nStartRow to nEndRow
' Next line specifies a value qualifying the row for deletion
if oCell.GetString = "apples" then
Count = Count + 1
oRows.removeByIndex(nRow,1) 'the second argument limits deletion to 1 row at a time
next
End Sub