ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Colors programatically (https://www.excelbanter.com/excel-programming/416651-colors-programatically.html)

steven

Colors programatically
 
What code do I use on a command button that will let the user choose a color
for interior and font.

Thanks you,

Steven

JLGWhiz

Colors programatically
 
With ActiveSheet.ActiveCell
.Interior.ColorIndex = 5
.Font.ColorIndex = 1
End With

"Steven" wrote:

What code do I use on a command button that will let the user choose a color
for interior and font.

Thanks you,

Steven


steven

Colors programatically
 
Thank you for the response. What I am looking for is to open up the palate
so they can choose their own color.


"JLGWhiz" wrote:

With ActiveSheet.ActiveCell
.Interior.ColorIndex = 5
.Font.ColorIndex = 1
End With

"Steven" wrote:

What code do I use on a command button that will let the user choose a color
for interior and font.

Thanks you,

Steven


JLGWhiz

Colors programatically
 
You wanted code to choose a color, not assign it. How many options do you
intend to offer out of the 56 available, or will they be able to just
randomly select? You could set up a ListBox with the color name and let the
user choose from that. The the code behind the ListBox could tell which cell
to apply the selected value to.
Using an Inputbox would require the options to be spelled out somewhere,
possibley in the InputBox narrative, for the user to know what to enter in
the input window.

Give me some idea of how you want to handle the option criteria and I can
give you some code for it.

"JLGWhiz" wrote:

With ActiveSheet.ActiveCell
.Interior.ColorIndex = 5
.Font.ColorIndex = 1
End With

"Steven" wrote:

What code do I use on a command button that will let the user choose a color
for interior and font.

Thanks you,

Steven


Dave Peterson

Colors programatically
 
For the font color:
Application.Dialogs(xlDialogFormatFont).Show
or
Application.Dialogs(xlDialogFontProperties).Show


For the pattern/fill:
Application.Dialogs(xlDialogPatterns).Show



Steven wrote:

What code do I use on a command button that will let the user choose a color
for interior and font.

Thanks you,

Steven


--

Dave Peterson

steven

Colors programatically
 

Very nice. Thank you.

"Dave Peterson" wrote:

For the font color:
Application.Dialogs(xlDialogFormatFont).Show
or
Application.Dialogs(xlDialogFontProperties).Show


For the pattern/fill:
Application.Dialogs(xlDialogPatterns).Show



Steven wrote:

What code do I use on a command button that will let the user choose a color
for interior and font.

Thanks you,

Steven


--

Dave Peterson


JLGWhiz

Colors programatically
 
myColor = Application.Dialogs(xlDialogColorPalette)

will return the palette but it will not allow you to select the color and
store it in the variable. Seem sort of dumb to me, but I tried two or three
different approaches and it keeps saying it can't get the value.

Think it over and see what else you can do.

"Steven" wrote:

Thank you for the response. What I am looking for is to open up the palate
so they can choose their own color.


"JLGWhiz" wrote:

With ActiveSheet.ActiveCell
.Interior.ColorIndex = 5
.Font.ColorIndex = 1
End With

"Steven" wrote:

What code do I use on a command button that will let the user choose a color
for interior and font.

Thanks you,

Steven



All times are GMT +1. The time now is 04:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com