Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA - use color already select in Excel to fill cell interior

Tags:

excel

colors

vba

I know how to set the interior color of a cell to a certain color, but is there a way to do it so that it (i.e., the cell color) defaults to the color already selected in the color window of the ribbon?

like image 336
Greg Avatar asked Aug 16 '11 19:08

Greg


1 Answers

I'm getting to this very late but since it popped up in a google search for something else, I thought I'd mention the selected answer is incorrect when it says you cannot do what the submitter wanted. You can activate the control directly with...

Application.CommandBars.ExecuteMso "CellFillColorPicker"

...and it will apply the currently selected color to the selected range.

I'm actually looking around to see if there is a way to select another color in the control's gallery via VBA so I can make the default "no fill" rather than yellow when first opening a workbook.

like image 70
justpassingthrough Avatar answered Sep 23 '22 21:09

justpassingthrough