discodavenyc1
New Member
- Joined
- Feb 23, 2007
- Messages
- 6
Hello All
I have the following code and I'd like to change the font color and background color of these buttons. I can't seem to find the proper code.
Please help. Thanks
Sub CreateButtons()
Dim x As Integer, cell As Range, btn As Object
For x = 10 To 20
For i = 1 To 3
Set cell = Cells(x, i)
Randomize
RandomString = RandString(20)
cell.Value = RandomString
Set btn = ActiveSheet.Buttons.Add(cell.Left, cell.Top, cell.Width, cell.Height)
With btn
.Caption = IIf(i = 1, "up", IIf(i = 2, "down", IIf(i = 3, "in", "")))
.Name = RandomString
'.BackColor = 65535 <--- THIS IS THE ROW RETURNING AN ERROR
.OnAction = "ProcessAction"
End With
Next i
Next x
I have the following code and I'd like to change the font color and background color of these buttons. I can't seem to find the proper code.
Please help. Thanks
Sub CreateButtons()
Dim x As Integer, cell As Range, btn As Object
For x = 10 To 20
For i = 1 To 3
Set cell = Cells(x, i)
Randomize
RandomString = RandString(20)
cell.Value = RandomString
Set btn = ActiveSheet.Buttons.Add(cell.Left, cell.Top, cell.Width, cell.Height)
With btn
.Caption = IIf(i = 1, "up", IIf(i = 2, "down", IIf(i = 3, "in", "")))
.Name = RandomString
'.BackColor = 65535 <--- THIS IS THE ROW RETURNING AN ERROR
.OnAction = "ProcessAction"
End With
Next i
Next x