Forum

Less than formula i...
 
Notifications
Clear all

Less than formula in VBA

3 Posts
2 Users
0 Reactions
81 Views
(@stevenbehr1)
Posts: 92
Estimable Member
Topic starter
 

Hi,

I have a text box on my line of orders on my warehouse module and I have VBA code for 1 cell that tells me QTY ordered in H9 that is less than QTY in stock please indicate RED. However, it indicates RED when its ZERO????

Is there anything on the below code that I have missed????

Private Sub Deg6_Change()

If Sheet12.Range("H9").Value > Sheet12.Range("K9").Value Then

MeDeg6.BackColor = vbRed

Else Me.Deg6.BackColor = vbGreen

End if

End Sub

 

Thanks

 

Steve

 
Posted : 30/01/2020 11:24 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Steven,

It's always best to supply your workbook and code so we can see exactly what you are working with and give a better answer.

Is the value in K9 text, rather than a number?

When I run the above code it works fine for me, except when I make K9 a text value.

Phil

 
Posted : 31/01/2020 12:01 am
(@stevenbehr1)
Posts: 92
Estimable Member
Topic starter
 

Hi Phil,

 

Your right! it was a text. The data swab was sending it to the wrong cell and picking that up.

 

Thanks

 

Steve

 
Posted : 31/01/2020 12:20 am
Share: