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
                    Else
                        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, 2023 in Others by Kithuzzz
• 38,010 points
250 views

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, 2023 by narikkadan
• 63,420 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
689 views
0 votes
0 answers
0 votes
1 answer
0 votes
1 answer

My VBA Addin creates a custom ribbon tab, but should only be visible for intended workbooks

The RibRefresh sub's logic is overly convoluted ...READ MORE

answered Feb 23, 2023 in Others by Kithuzzz
• 38,010 points
908 views
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
915 views
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
3,238 views
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
• 23,260 points
528 views
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,670 points
769 views
0 votes
1 answer

Can an Excel xll function indicate that the return value should be displayed as a date and not a number?

To my knowledge, the only method to ...READ MORE

answered Jan 5, 2023 in Others by narikkadan
• 63,420 points
515 views
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
• 63,420 points
3,010 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP