AnsweredAssumed Answered

If statement not working

Question asked by Topper1 on Jan 22, 2019
Latest reply on Jan 22, 2019 by TimCarmichael

I am having a issue with this.

Sub test()

 

Dim T As Trend

Dim f As TrendFormat

Dim s As Double

Dim c As Double

Dim i As String

Dim d As String

Dim s2 As Double

Dim i2 As Double

 

 

Set T = ThisDisplay.Trend1

Set f = T.GetFormat

c = ThisDisplay.Value1.GetValue(d, st)

s = ThisDisplay.Text1.Contents

d = ThisDisplay.Value2.GetValue(d, st)

i = ThisDisplay.Text2.Contents

s2 = ThisDisplay.Text4.Contents

i2 = ThisDisplay.Text5.Contents

  

   

   

    If d = "DENT" Then

    'changing using dent specs off corn type

        If c < s Or c > i Then f.Elements(pbBackGround).Color = RGB(255, 255, 0) And f.Elements(pbPen1).Color = RGB(255, 0, 255) Else f.Elements(pbBackGround).Color = RGB(0, 255, 0) And f.Elements(pbPen1).Color = RGB(0, 0, 255)

    Else

    'changeing using waxy specs off corn type

        If c >= s2 Or c <= i2 Then f.Elements(pbBackGround).Color = RGB(255, 255, 0) And f.Elements(pbPen1).Color = RGB(255, 0, 0) Else f.Elements(pbBackGround).Color = RGB(0, 255, 0) And f.Elements(pbPen1).Color = RGB(0, 0, 255)

    End If

 

    T.SetFormat f

 

Set T = Nothing

 

 

End Sub

The issue is the first then section is causing my trend to go black and not changing pen color.

Attachments

Outcomes