Hello,
I'd like to make this kind of template in USerForm
I'm writing code to change CommandButton color based on excel cell. CommandButton color will be the same like excell's cell color. I', able to do it one by one as below just for few buttons with number 1:
I'm tryinf to do it in a loop but still have a problems like Buttons aren't marked or even UserForm isn't show.
Can someone help me how to do it in a loop ?
I'd like to make this kind of template in USerForm
I'm writing code to change CommandButton color based on excel cell. CommandButton color will be the same like excell's cell color. I', able to do it one by one as below just for few buttons with number 1:
VBA Code:
If ThisWorkbook.Worksheets("Skill_matrix_laboratorium").Cells(17, 4).Interior.Color = RGB(255, 255, 0) Then 'BHP
CommandButton4.BackColor = RGB(255, 255, 0)
Else: CommandButton4.BackColor = RGB(255, 255, 255)
End If
If ThisWorkbook.Worksheets("Skill_matrix_laboratorium").Cells(17, 7).Interior.Color = RGB(255, 255, 0) Then 'PPOŻ
CommandButton8.BackColor = RGB(255, 255, 0)
Else: CommandButton8.BackColor = RGB(255, 255, 255)
End If
If ThisWorkbook.Worksheets("Skill_matrix_laboratorium").Cells(17, 10).Interior.Color = RGB(255, 255, 0) Then
CommandButton12.BackColor = RGB(255, 255, 0)
Else: CommandButton12.BackColor = RGB(255, 255, 255)
End If
I'm tryinf to do it in a loop but still have a problems like Buttons aren't marked or even UserForm isn't show.
VBA Code:
For i = 1 To 72 Step 3
If ThisWorkbook.Worksheets("Skill_matrix_laboratorium").Cells(17, i).Interior.Color = RGB(255, 255, 0) Then
Select Case i
Case i = 4
ommandButton4.BackColor = RGB(255, 255, 0)
Case i = 7
CommandButton8.BackColor = RGB(255, 255, 0)
Case i = 10
CommandButton12.BackColor = RGB(255, 255, 0)
End Select
End If
Next i
Can someone help me how to do it in a loop ?