Hi All,
I am new to the site, and I have come unstuck on something that should be simple.
I am trying to create a excel front page that shows a figure in an Activex text box that is changed in colour from Red to Green depending on the value between two cells. I have got the code to work fine with the below example if I type in the >= figure as part of the code, but I cannot get the VB code to see the cell "X5" which would enable me to change the figure within the sheet.
As it stands the ActiveX textbox obtains one of the values via the properties LinkedCell option "T5" , and works as below. (This correctly changes the colour of the text from Green to Red if the value in the Activex Text box is less than 60.
--------------------
Private Sub TextBox3_Change()
Dim x
x = IIf(TextBox4.Value >= 60, RGB(255, 0, 0), RGB(0, 176, 80))
Me.TextBox3.ForeColor = x
End Sub
---------------------
So I try the below to enable me to use the >= value from the Cell "X5" so that the figure can be modified for different values and disciplines without changing the code. The VB is ok but it just doesn't work, I have also tried using .text instead of .value but then I get mixed results and random figures below 100 change from red to green and anything over 100 is just Green. I have tried Cell.Range, Cell.Value, Ranges Etc
Private Sub TextBox3_Change()
Dim x
x = IIf(TextBox3.Value >= ActiveSheet.Range("X5").Value, RGB(255, 0, 0), RGB(0, 176, 80))
Me.TextBox3.ForeColor = x
End Sub
Pulling my hair out on this and I am probably missing something obvious. So any help gratefully appreciated.
Thanks
Christopher.
I am new to the site, and I have come unstuck on something that should be simple.
I am trying to create a excel front page that shows a figure in an Activex text box that is changed in colour from Red to Green depending on the value between two cells. I have got the code to work fine with the below example if I type in the >= figure as part of the code, but I cannot get the VB code to see the cell "X5" which would enable me to change the figure within the sheet.
As it stands the ActiveX textbox obtains one of the values via the properties LinkedCell option "T5" , and works as below. (This correctly changes the colour of the text from Green to Red if the value in the Activex Text box is less than 60.
--------------------
Private Sub TextBox3_Change()
Dim x
x = IIf(TextBox4.Value >= 60, RGB(255, 0, 0), RGB(0, 176, 80))
Me.TextBox3.ForeColor = x
End Sub
---------------------
So I try the below to enable me to use the >= value from the Cell "X5" so that the figure can be modified for different values and disciplines without changing the code. The VB is ok but it just doesn't work, I have also tried using .text instead of .value but then I get mixed results and random figures below 100 change from red to green and anything over 100 is just Green. I have tried Cell.Range, Cell.Value, Ranges Etc
Private Sub TextBox3_Change()
Dim x
x = IIf(TextBox3.Value >= ActiveSheet.Range("X5").Value, RGB(255, 0, 0), RGB(0, 176, 80))
Me.TextBox3.ForeColor = x
End Sub
Pulling my hair out on this and I am probably missing something obvious. So any help gratefully appreciated.
Thanks
Christopher.