![]() |
Button colour
I have a button on a userform. When a certain checkbox
is checked I want the button to appear black. I do this using the BackColour property and using 17 as the color number. When the checkbox is not checked I want to turn the colour of the button back to grey. I am using 15 for this. However, the button will not change to the colour denoted by 15 when I do this. That is, it stays at black (17) even if the chbkx = False. Why is this? Thanks If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If |
Button colour
Also note that I am doing all of this within the click
event of the chbkx Private Sub PrintColourMapChkBx_Click() If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If End Sub -----Original Message----- I have a button on a userform. When a certain checkbox is checked I want the button to appear black. I do this using the BackColour property and using 17 as the color number. When the checkbox is not checked I want to turn the colour of the button back to grey. I am using 15 for this. However, the button will not change to the colour denoted by 15 when I do this. That is, it stays at black (17) even if the chbkx = False. Why is this? Thanks If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If . |
Button colour
You are using colorindex, not the color. Try
Private Sub PrintColourMapChkBx_Click() If PrintColourMapChkBx = True Then CellComColBtn.BackColor = &H0 Else CellComColBtn.BackColor = &H8000000F End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "ExcelMonkey" wrote in message ... Also note that I am doing all of this within the click event of the chbkx Private Sub PrintColourMapChkBx_Click() If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If End Sub -----Original Message----- I have a button on a userform. When a certain checkbox is checked I want the button to appear black. I do this using the BackColour property and using 17 as the color number. When the checkbox is not checked I want to turn the colour of the button back to grey. I am using 15 for this. However, the button will not change to the colour denoted by 15 when I do this. That is, it stays at black (17) even if the chbkx = False. Why is this? Thanks If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If . |
Button colour
thank-you bob. Quick question, what does the &H signify?
How do I know what code to use for what colour going forward? -----Original Message----- You are using colorindex, not the color. Try Private Sub PrintColourMapChkBx_Click() If PrintColourMapChkBx = True Then CellComColBtn.BackColor = &H0 Else CellComColBtn.BackColor = &H8000000F End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "ExcelMonkey" wrote in message ... Also note that I am doing all of this within the click event of the chbkx Private Sub PrintColourMapChkBx_Click() If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If End Sub -----Original Message----- I have a button on a userform. When a certain checkbox is checked I want the button to appear black. I do this using the BackColour property and using 17 as the color number. When the checkbox is not checked I want to turn the colour of the button back to grey. I am using 15 for this. However, the button will not change to the colour denoted by 15 when I do this. That is, it stays at black (17) even if the chbkx = False. Why is this? Thanks If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If . . |
Button colour
The H is Hex.
I got the colour code simply by looking at the BackColor property for a new button, that told me it was &H8000000F. I knew that black was &H0, as I know that white is &HFFFFFF, red is &H0000FF, green is &H00FF00, and blue is &HFF0000, but beyond that I have to look it up :-). -- HTH RP (remove nothere from the email address if mailing direct) "ExcelMonkey" wrote in message ... thank-you bob. Quick question, what does the &H signify? How do I know what code to use for what colour going forward? -----Original Message----- You are using colorindex, not the color. Try Private Sub PrintColourMapChkBx_Click() If PrintColourMapChkBx = True Then CellComColBtn.BackColor = &H0 Else CellComColBtn.BackColor = &H8000000F End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "ExcelMonkey" wrote in message ... Also note that I am doing all of this within the click event of the chbkx Private Sub PrintColourMapChkBx_Click() If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If End Sub -----Original Message----- I have a button on a userform. When a certain checkbox is checked I want the button to appear black. I do this using the BackColour property and using 17 as the color number. When the checkbox is not checked I want to turn the colour of the button back to grey. I am using 15 for this. However, the button will not change to the colour denoted by 15 when I do this. That is, it stays at black (17) even if the chbkx = False. Why is this? Thanks If PrintColourMapChkBx = True Then CellComColBtn.BackColor = 17 End if If PrintColourMapChkBx = False Then CellComColBtn.BackColor = 15 End If . . |
All times are GMT +1. The time now is 12:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com