ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ComboBox with colors? (https://www.excelbanter.com/excel-programming/353993-combobox-colors.html)

Ctech[_102_]

ComboBox with colors?
 

Hi

I'm trying to make a macro which sums up all cells in a range with a
certain color.

However Im trying to find a userfriendly way to pick the color.

Is it possible to use the color picker in the tool bar, like an excel
object?
If not is it possible to get a combo box to have background colors on
eaech case?

Cheers


--
Ctech


------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=515244


Bob Phillips[_6_]

ComboBox with colors?
 
Here is one way to provide a colour picker

'-----------------------------*------------------------------*--------------
Private Function GetColorindex(Optional Text As Boolean False) As Long
'-----------------------------*------------------------------*--------------
Dim rngCurr As Range

Set rngCurr Selection
Application.ScreenUpdating False
Range("IV1").Select
Application.Dialogs(xlDialogPatterns).Show
GetColorindex ActiveCell.Interior.ColorIndex
If GetColorindex xlColorIndexAutomatic And Not Text Then
GetColorindex xlColorIndexNone
End If
ActiveCell.Interior.ColorIndex xlColorIndexAutomatic
rngCurr.Select
Set rngCurr ActiveSheet.UsedRange
Application.ScreenUpdating True
End Function

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Ctech" wrote in
message ...

Hi

I'm trying to make a macro which sums up all cells in a range with a
certain color.

However Im trying to find a userfriendly way to pick the color.

Is it possible to use the color picker in the tool bar, like an excel
object?
If not is it possible to get a combo box to have background colors on
eaech case?

Cheers


--
Ctech


------------------------------------------------------------------------
Ctech's Profile:

http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=515244




Ctech[_103_]

ComboBox with colors?
 

How do I use this Function?
Do I have to run it in another macro, if so how?


When I paste this into a new module... I get several errors i.e

Set rngCurr Selection ----- should it be Set rngCurr = Selectio

--
Ctec

-----------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...fo&userid=2774
View this thread: http://www.excelforum.com/showthread.php?threadid=51524


Bob Phillips[_6_]

ComboBox with colors?
 
I assumed that you had some VBA to use a colour, so this would need to be
integrated with it.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Ctech" wrote in
message ...

How do I use this Function?
Do I have to run it in another macro, if so how?


When I paste this into a new module... I get several errors i.e

Set rngCurr Selection ----- should it be Set rngCurr = Selection


--
Ctech


------------------------------------------------------------------------
Ctech's Profile:

http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=515244





All times are GMT +1. The time now is 11:31 PM.

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