-
-
Save eniehack/e2f4006397cb24d7d831aa27d6b228f2 to your computer and use it in GitHub Desktop.
This file contains 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
Sub Main | |
dim units_sum(5) as integer | |
dim sheet as object | |
dim i() | |
dim val as integer | |
sheet = ThisComponent.Sheets(0) | |
units = sheet.getCellRangeByName("C3:F44").getDataArray() | |
for each i in units() | |
rem print CStr(i(0)) + CStr(i(1)) | |
Select Case i(1) | |
Case 1: | |
units_sum(0) = units_sum(0) + i(0) | |
Case 2: | |
units_sum(1) = units_sum(1) + i(0) | |
Case 3: | |
units_sum(2) = units_sum(2) + i(0) | |
Case 4: | |
units_sum(3) = units_sum(3) + i(0) | |
Case 5: | |
units_sum(4) = units_sum(4) + i(3) | |
Case Else: | |
End Select | |
Next i | |
for val = 0 to 4 | |
rem Print CStr(val+1) + ": " + CStr(units_sum(val)) | |
ThisComponent.Sheets(1).getCellByPosition(val+2, 3).Value = units_sum(val) | |
next val | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment