Hello and thanks for looking
on a Userform in Initialize
I would like the label boxes to change color based on the cell value in Column F
Values would be "Day Shift", "NIGHT SHIFT", or an emtpy cell
or stay the same back color as the userform if there is nothing in column F
Cells where the value is are in range F3:F41
Label boxes are named Lb3 to Lb41
in the Userform it does a couple things before this step...they are
1st) puts the contents of cells F3:F41 in label boxes 3 to 41 ( same row , same box number )
2nd) formats the label boxes for zip codes
3rd ) darkens 2 of the label boxes, ( we don't use them any more )
the next step to happen should be the color changing
this is what I started with, but nothing happens, no changes or errors
as always Thank you
Thomas
on a Userform in Initialize
I would like the label boxes to change color based on the cell value in Column F
Values would be "Day Shift", "NIGHT SHIFT", or an emtpy cell
or stay the same back color as the userform if there is nothing in column F
Cells where the value is are in range F3:F41
Label boxes are named Lb3 to Lb41
in the Userform it does a couple things before this step...they are
1st) puts the contents of cells F3:F41 in label boxes 3 to 41 ( same row , same box number )
2nd) formats the label boxes for zip codes
3rd ) darkens 2 of the label boxes, ( we don't use them any more )
the next step to happen should be the color changing
this is what I started with, but nothing happens, no changes or errors
Code:
Dim sh1 As Worksheet
Set sh1 = Sheets("ListPage")
' makes label boxes Yellow for Day Shift
' and a shade of Red for Night Shift
' and the same color as the userform if not assigned
For j = 3 To 41
If sh1.Cells(j, 6).Value = "" Then
UFZipAssigned.Controls("Lb" & j).BackColor = &HFFFF80
End If
Next j
For j = 3 To 41
If sh1.Cells(j, 6).Value = "Day Shift" Then
UFZipAssigned.Controls("Lb" & j).BackColor = vbYellow
End If
Next j
For j = 3 To 41
If sh1.Cells(j, 6).Value = "Night Shift" Then
UFZipAssigned.Controls("Lb" & j).BackColor = &H8080FF
End If
Next j
as always Thank you
Thomas