A value which should be judged by a scale gets bad judgement sometimes

0 votes

A weight measurement exists and provides us with various numbers. However, there is always a reference weight, such as 100, thus the Min-Max will always be within 10%. (90 - 110).

It is the responsibility of the code to determine whether anything is acceptable or not. For example, if it is 89.9, that is NOT GOOD, but if it is 99.2, that is OK.

Sometimes a problem arises for no apparent reason because, despite being on the scale, it goes BAD, and other times it is not on the scale and goes OK.

This is the section of the code that is crucial; (Not mine code, I just have to fix it somehow)

                    If Val(txtWeight.Value) < Val(txtMinWeight.Value) Or Val(txtWeight.Value) > Val(txtMaxWeight.Value) Then
                        lblJudgement.Caption = "NOT GOOD"
                        Sheets("Measurment").Cells(j, 2).Value = "NOT GOOD"
                        lblJudgement.BackColor = 255
                        txtWeight.BackColor = 255
                        Call BadSound
                        lblJudgement.Caption = "OK"
                        Sheets("Measurment").Cells(j, 2).Value = "OK"
                        lblJudgement.BackColor = 49152
                        txtWeight.BackColor = 49152
                        Call GoodSound
                    End If

As long as I see it, all the formulas, and calculations should be good, so I have no clue why it turns around sometimes and give back wrong judgments.

Jan 8 in Others by Kithuzzz
• 28,900 points

1 answer to this question.

0 votes
Only the period (.) is accepted by the Val function as a legitimate decimal separator. Use CDbl to convert a string to a number instead when various decimal separators are employed, such as in foreign applications.
answered Jan 8 by narikkadan
• 53,520 points

Related Questions In Others

0 votes
1 answer

In order to learn Node.js, I should be familiar with which other technologies ?

I appreciate your decision, its the perfect ...READ MORE

answered Jul 31, 2019 in Others by ArchanaNagur
• 2,360 points
0 votes
0 answers
0 votes
1 answer
0 votes
1 answer

Change the permission for a file created by me in linux

If you are the system administrator or ...READ MORE

answered Mar 8, 2019 in Others by Nabarupa
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 22,960 points
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,630 points
0 votes
1 answer
0 votes
1 answer

How to find a value in an excel column by vba code Cells.Find

Just use: Dim Cell As Range Columns("B:B").Select Set cell = ...READ MORE

answered Nov 17, 2022 in Others by narikkadan
• 53,520 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP