Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anybody help me out.
I have a sheet filled with colors. Some of these colors are not preset color palette colors, but user defined. Now I want to change certain buttons on a form I have created to have the background color of a cell. I tried the colorindex and color property, however none of these give the desired result for the user defined colors. Therefore I would like to have the RGB code for these colors. Is this possible or is there any workaround? Thanks in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() s/b simple assuming you are using an embedded forms commandbutton: Private Sub CommandButton1_Click() With CommandButton1 .BackColor = .TopLeftCell.Interior.Color End With End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Can anybody help me out. I have a sheet filled with colors. Some of these colors are not preset color palette colors, but user defined. Now I want to change certain buttons on a form I have created to have the background color of a cell. I tried the colorindex and color property, however none of these give the desired result for the user defined colors. Therefore I would like to have the RGB code for these colors. Is this possible or is there any workaround? Thanks in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks this works!
However I use a userform and not an embedded form. I have copied the code in the initilize event, however then it does not work. Only on a click event it works. Do you know why? "keepITcool" schreef: s/b simple assuming you are using an embedded forms commandbutton: Private Sub CommandButton1_Click() With CommandButton1 .BackColor = .TopLeftCell.Interior.Color End With End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Can anybody help me out. I have a sheet filled with colors. Some of these colors are not preset color palette colors, but user defined. Now I want to change certain buttons on a form I have created to have the background color of a cell. I tried the colorindex and color property, however none of these give the desired result for the user defined colors. Therefore I would like to have the RGB code for these colors. Is this possible or is there any workaround? Thanks in advance |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
show me your code
-- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Thanks this works! However I use a userform and not an embedded form. I have copied the code in the initilize event, however then it does not work. Only on a click event it works. Do you know why? "keepITcool" schreef: s/b simple assuming you are using an embedded forms commandbutton: Private Sub CommandButton1_Click() With CommandButton1 .BackColor = .TopLeftCell.Interior.Color End With End Sub -- keepITcool www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Can anybody help me out. I have a sheet filled with colors. Some of these colors are not preset color palette colors, but user defined. Now I want to change certain buttons on a form I have created to have the background color of a cell. I tried the colorindex and color property, however none of these give the desired result for the user defined colors. Therefore I would like to have the RGB code for these colors. Is this possible or is there any workaround? Thanks in advance |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub UserForm_Initialize()
myheight = 12 mytop = 70 mywidth = 12 myleft = 12 Set Mycmd = Controls.Add("Forms.CommandButton.1", "Test") Mycmd.Left = myleft Mycmd.Top = mytop Mycmd.Width = mywidth Mycmd.Height = myheight Range("a2").Select Mycmd.BackColor = Range("a2").Interior.Color End Sub "keepITcool" schreef: show me your code -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Thanks this works! However I use a userform and not an embedded form. I have copied the code in the initilize event, however then it does not work. Only on a click event it works. Do you know why? "keepITcool" schreef: s/b simple assuming you are using an embedded forms commandbutton: Private Sub CommandButton1_Click() With CommandButton1 .BackColor = .TopLeftCell.Interior.Color End With End Sub -- keepITcool www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Can anybody help me out. I have a sheet filled with colors. Some of these colors are not preset color palette colors, but user defined. Now I want to change certain buttons on a form I have created to have the background color of a cell. I tried the colorindex and color property, however none of these give the desired result for the user defined colors. Therefore I would like to have the RGB code for these colors. Is this possible or is there any workaround? Thanks in advance |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() yes... strange and unexpected :( but easily solved with :) Mycmd.BackColor = ActiveWorkbook.Colors(Range("a2").Interior.ColorIn dex) -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Private Sub UserForm_Initialize() myheight = 12 mytop = 70 mywidth = 12 myleft = 12 Set Mycmd = Controls.Add("Forms.CommandButton.1", "Test") Mycmd.Left = myleft Mycmd.Top = mytop Mycmd.Width = mywidth Mycmd.Height = myheight Range("a2").Select Mycmd.BackColor = Range("a2").Interior.Color End Sub "keepITcool" schreef: show me your code -- keepITcool www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Thanks this works! However I use a userform and not an embedded form. I have copied the code in the initilize event, however then it does not work. Only on a click event it works. Do you know why? "keepITcool" schreef: s/b simple assuming you are using an embedded forms commandbutton: Private Sub CommandButton1_Click() With CommandButton1 .BackColor = .TopLeftCell.Interior.Color End With End Sub -- keepITcool www.XLsupport.com | keepITcool chello nl | amsterdam Brotha lee wrote : Can anybody help me out. I have a sheet filled with colors. Some of these colors are not preset color palette colors, but user defined. Now I want to change certain buttons on a form I have created to have the background color of a cell. I tried the colorindex and color property, however none of these give the desired result for the user defined colors. Therefore I would like to have the RGB code for these colors. Is this possible or is there any workaround? Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell interior color | Excel Discussion (Misc queries) | |||
Code to change interior colour only if current interior colour is | Excel Programming | |||
Conditional Format with VBA - Interior Colour of cell based on value from in-cell dropdown | Excel Programming | |||
Interior Cell color | Excel Programming |