Created
June 30, 2014 16:12
-
-
Save chrishuan9/2e466d7b427b890b8313 to your computer and use it in GitHub Desktop.
Remove every nth line in Libreoffice Calc document
This file contains hidden or 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 ***** | |
Sub Main | |
dim sStartRowInput as String | |
dim sEndRowInput as String | |
dim startRow as Integer | |
dim endRow as Integer | |
dim stepCount as Integer | |
dim sheetName as String | |
'Deletes every second row by default - modify stepCount ot alter behaviour | |
stepCount = 2 | |
'Specify name of the sheet that macro is applied to | |
sheetName = "Nexus4-HW" | |
'ask the user for a starting row to remove every second line | |
sStartRowInput = InputBox("Please enter the starting row number","Delete every second row") | |
sEndRowInput = InputBox("Please enter the ending row number","Delete every second row") | |
if sStartRowInput = "" then 'User clicked Cancel | |
print("Exiting..") | |
exit sub | |
else | |
'Converts any string or numeric expression to a long integer | |
startRow = CLng(sStartRowInput) | |
endRow = CLng(sEndRowInput) | |
endif | |
' access the document model using ThisComponent | |
Dim oSheet3 | |
oSheet3 = ThisComponent.getSheets().getByName(sheetName) | |
oRows = oSheet3.getRows() | |
for iLoopCount = startRow To endRow Step stepCount | |
'statements | |
oRows.removeByIndex(iLoopCount,1) | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment