Hi,
I have 58 text boxes all of which can have a value from -32 to 40 and im trying to set a colour od the textbox dependant on its number,
between -32 and -3 is one colour
between -2 on 0 is another colour
and
between 1 and 40 is another colour.
Ive tried using various bit of code but cant quite get anything to work.
Has anyone got any insights to share?
Thanks in advance
The below code is the closest I have got,
I have also posted this here http://www.ozgrid.com/forum/showthre...767#post773767
Sub Fill1()
Dim ctrlNum As Integer
ctrlNum = 1
For r = 658 To 710
For c = 1 To 1
With Userform1.Controls("TextBox" & ctrlNum)
.BackColor = RGB(IIf(ThisWorkbook.Sheets("Data").Range("C" & r).Value <= -3, 218, 255), _
IIf(ThisWorkbook.Sheets("Data").Range("C" & r).Value = <= -3, 150, 255), _
IIf(ThisWorkbook.Sheets("Data").Range("C" & r).Value = <= -3, 148, 204))
End With
ctrlNum = ctrlNum + 1
Next
Next
Bookmarks