On Sheet1
, summation of range B8:B13
is 1104.61
and summation of range C8:C13
is 1104.61
on Macro Sub TestEqualOperatorOnSheet1
.
Why did If DrASOE2 <> CrASOE2 Then
(line 16) return true ?
Sub TestEqualOperatorOnSheet1
Dim oSheet As Object
Dim iASOE2, rASOE2, rrASOE2 As Integer
Dim DrASOE2, CrASOE2 As Double
DrASOE2 = 0
CrASOE2 = 0
oSheet = ThisComponent.Sheets.getByName("Sheet1")
ThisComponent.CurrentController.setActiveSheet(oSheet)
For iASOE2 = 1 To 20
If UCase(oSheet.getCellByPosition(0, iASOE2).String) = "NEW" Then
rrASOE2 = rASOE2
rASOE2 = iASOE2
MsgBox DrASOE2 & chr(10) & CrASOE2 & chr(10) & iASOE2,, "DrASOE2" & chr(10) & "CrASOE2" & chr(10) & "iASOE2"
If DrASOE2 <> CrASOE2 Then
MsgBox "Total debit amount is not equal to credit amount in batch of row " & rrASOE2 + 1 & ".",,"Error"
Stop
End If
DrASOE2 = 0
CrASOE2 = 0
DrASOE2 = DrASOE2 + oSheet.getCellByPosition(1, iASOE2).Value
CrASOE2 = CrASOE2 + oSheet.getCellByPosition(2, iASOE2).Value
Else
DrASOE2 = DrASOE2 + oSheet.getCellByPosition(1, iASOE2).Value
CrASOE2 = CrASOE2 + oSheet.getCellByPosition(2, iASOE2).Value
End If
Next
MsgBox DrASOE2 & chr(10) & CrASOE2,, "DrASOE2" & chr(10) & "CrASOE2"
MsgBox "Total debit amount is equal to credit amount in every batch."
End Sub
It also happened with Sub TestEqualOperatorOnSheet2
.
And it also happened with Sub TestEqualOperatorOnSheet3
if I placed the same range on Sheet3
.
Please click on menu Test LibreOffice Calc BASIC
to run macros.
LOCalcBASIC_EqualOperator.ods (33.0 KB)
LibreOffice:
Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.1
Calc: threaded
OS:
Ubuntu 22.04