davis1118
03-16-2018, 02:03 PM
I finally have all the code for my userform working properly, and I am going back through to clean it up. When the userform initializes I am changing the backcolor on the Userform and then all the Frames and Labels. There has to be a cleaner way to write the code below. I always get good help from the experts on this forum and wanted to see what options I have. Any suggestions would be appreciated.
Dim color As String
color = RGB(166, 192, 214)
With EditProcessForm
.BackColor = color
.Frame1.BackColor = color
.Frame2.BackColor = color
.Frame3.BackColor = color
.Label1.BackColor = color
.Label2.BackColor = color
.Label3.BackColor = color
.Label4.BackColor = color
.Label5.BackColor = color
.Label6.BackColor = color
.Label7.BackColor = color
.Label8.BackColor = color
.Label9.BackColor = color
.Label10.BackColor = color
.Label11.BackColor = color
.Label12.BackColor = color
.Label13.BackColor = color
.Label14.BackColor = color
.Label15.BackColor = color
.Label16.BackColor = color
.Label17.BackColor = color
.Label18.BackColor = color
.Label19.BackColor = color
.Label20.BackColor = color
.Label21.BackColor = color
.Label22.BackColor = color
.Label23.BackColor = color
.Label24.BackColor = color
End With
Thanks for the help!
Dim color As String
color = RGB(166, 192, 214)
With EditProcessForm
.BackColor = color
.Frame1.BackColor = color
.Frame2.BackColor = color
.Frame3.BackColor = color
.Label1.BackColor = color
.Label2.BackColor = color
.Label3.BackColor = color
.Label4.BackColor = color
.Label5.BackColor = color
.Label6.BackColor = color
.Label7.BackColor = color
.Label8.BackColor = color
.Label9.BackColor = color
.Label10.BackColor = color
.Label11.BackColor = color
.Label12.BackColor = color
.Label13.BackColor = color
.Label14.BackColor = color
.Label15.BackColor = color
.Label16.BackColor = color
.Label17.BackColor = color
.Label18.BackColor = color
.Label19.BackColor = color
.Label20.BackColor = color
.Label21.BackColor = color
.Label22.BackColor = color
.Label23.BackColor = color
.Label24.BackColor = color
End With
Thanks for the help!