Excel Color Picker

Formula11

Active Member
Joined
Mar 1, 2005
Messages
461
Office Version
  1. 365
Platform
  1. Windows
Calling up a font colour picker with VBA doesn't seem to work (using "Application.Dialogs(xlDialogColorPalette).Show").
A good method is given here: Excel Color Picker - Collection of VBA Code Snippets and Useful Excel Knowledge.
I don't know how to call the procedure, given that arguments are required. I tried a couple of ways as follows but neither worked. Where am I going wrong?

Code:
Sub Test1()
Color2RGB 256, 256, 256, 256
End Sub

Sub Test2()
Call Color2RGB (256, 256, 256, 256)
End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Thank-you thisoldman.
The instructions for "Application.Dialogs(xlDialogColorPalette).Show" in the above link still do not work. I don't think it can be done.
It looks like the link in my original post is for interior cell colour as well.
I actually needed something for the font, ie "Application.Dialogs(xlDialogColorPalette).Show".
Never mind.
 
Upvote 0
I looked into this a bit more. This code brings up the custom color dialog and changes the font color to the user selection. If the user cancels, font color is unchanged. The procedure works but I did not thoroughly test it.
Code:
Sub UserChangeFontColor()
' Allow user to change the font color of the selected range.
    Dim userColor As Long
    Dim res As Integer
    
    res = Application.Dialogs(xlDialogEditColor).Show(12, 127, 127, 127)
    
    ' The arg of .Colors() must be the same as first arg of .Show(), above.
    userColor = ThisWorkbook.Colors(12)
    Selection.Font.Color = userColor
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top