I need to generate buttons, labeled by data in the spreadsheet, and place them in specific cells. Each needs to have background color set programaticall based on code logic.
I can create them, size them, place them, and set font info:
Set rt = WSOut.Range(sButtonCol & k).Cells
Set btn = WSOut.Buttons.Add(rt.Left + 1, rt.Top + 1, 60, 8)
btn.Select
With btn
.OnAction = "ButtonAction"
.Caption = sTicker
.Name = sTicker
.Font.ColorIndex = 1
.Font.Bold = True
.Font.Size = 7
End With
But what I CAN NOT seem to find is how to set the background color of the button. This is essential for quickly picking out the button set needed from the 100 or so in the sheet. I've tried
btn.Interior.Color = RGB(0, 255, 0)
but that seems to apply to some sort of manually created buttons
This sheet needs to be regenerated with fresh data frequently, and the buttons recreated from the data. Works perfectly, except for the 100 buttons all being the same color.
Appreciate any help. I've spent 2 hours hunting with Dr. Goog but no luck.
Pete A