Excel Change Background Color of Selected Cells With Scrollbar Control On Userform

Excel VBA: Change Cell's Background Color With Userform

          The userform starts as automatically when the worksheet is opened .Background color of selected cells can be changed with VBA scrollbar control on this userform.
The scrollbar's min value is 0, the maximum value is 56.

The related VBA codes:
Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub ScrollBar1_Change()
TextBox1.Value = ScrollBar1.Value
Selection.Interior.ColorIndex = ScrollBar1.Value
End Sub

Private Sub UserForm_Initialize()
ScrollBar1.Min = 0
ScrollBar1.Max = 56
End Sub

excel change background color

No comments:

Post a Comment