Hi,
When posting code, please wrap it with code tags ( Edit code - select code - click the #button.)
It keeps the macro's structure and makes it easy to copy and handle.
Thank you
I took a cell on a worksheet and changed the background color. I recorded a macro while I did this. You see in the macro that the cell background color is 10092543.
Sub Macro2()
'
' Macro2 Macro
'
'
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 10092543
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
The back color on my command button is &H00C0FFFF&.
How do I get the backcolor on the cell and the command button to be the same?
Hi,
When posting code, please wrap it with code tags ( Edit code - select code - click the #button.)
It keeps the macro's structure and makes it easy to copy and handle.
Thank you
Thank you Ken for this secure forum.
Code:.Color = CommandButton1.BackColor
Using your code I get run-time error '424'
Object required.
try
Code:.Color = ActiveSheet.CommandButton1.BackColor
Thank you all for your help.
I ended up with the following code:
You must color the backcolor of the command button by using palette in order for this code to work. If you color it using system, cell d10 will be black.Code:Public Sub cc() Range("D10").Interior.Color = ActiveSheet.CommandButton1.BackColor End Sub
Bookmarks