Changing colour of cells using command button (VBA Excel)
<p>I currently have a userform that loads up with three command buttons (primary, secondary and tertiary). The idea here is that a user will select their own colour scheme using these three buttons.</p>

<p>I have cells in my workbook that represent each colour and then a macro which sets all chart objects to these colours (using the cells) when it is run.</p>

<p>I have managed to initialise the userform so that the three command buttons interior colour is determined by the three cells in my workbook:</p>

<pre><code>Private Sub UserForm_Initialize()

Dim cs As Worksheet
Set cs = Sheets("ColourScheme")

TextBox1.SetFocus '' Shift focus away from primary

Primary.BackColor = cs.Range("B1").Interior.color
Secondary.BackColor = cs.Range("B2").Interior.color
Tertiary.BackColor = cs.Range("B3").Interior.color

End Sub
</code></pre>

<p>What I want to do now is that when each button is clicked, the colour palette loads up, the user selects a colour either using the wheel or an RGB figure and then finally the cells in my workbook and the command buttons interior colour change based on the user's choice.</p>

<p>I don't know if this can be done but so far I'm having no luck with anything I've tried to load the palette up:</p>

<pre><code>Private Sub Primary_Click()

Application.Dialogs.Item(xlDialogColorPalette).Show

End Sub
</code></pre>