Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Another Command button doubt...
Hi to all!
Here you have another question about a macro... I need to change the fill color of some cells by clicking a command button. I've searched VB help but I haven0t found anything. If anyone knows the correct code please write it... Thanks to all! -- atrep |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Another Command button doubt...
Try recording a macro when you change the selected cell's fill color.
Then stop recording. Then add a commandbutton from the control toolbar toolbox to the worksheet. Double click on that commandbutton and you'll see where you want to move the code. Then delete the original recorded macro. When you're done, you should end up with a routine that looks like: Option Explicit Private Sub CommandButton1_Click() Selection.Interior.ColorIndex = 35 End Sub The number will depend on what color you use. xavi garriga wrote: Hi to all! Here you have another question about a macro... I need to change the fill color of some cells by clicking a command button. I've searched VB help but I haven0t found anything. If anyone knows the correct code please write it... Thanks to all! -- atrep -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Another Command button doubt...
the simplest way
if it is always the same cells you want changed, record a macro changing them it will be something like Sub colcel() Range("D6,F12,H7").Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With End Sub assign a button to that macro change color index to get the color you want if you want to select the cells then change them try Sub colcel1() With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With End Sub if you need the macro to select the cells, what is your criteria? "xavi garriga" wrote: Hi to all! Here you have another question about a macro... I need to change the fill color of some cells by clicking a command button. I've searched VB help but I haven0t found anything. If anyone knows the correct code please write it... Thanks to all! -- atrep |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Another Command button doubt...
Ok Many thanks!
I'll try the solutions ans tell you if they work! -- atrep "Dave Peterson" wrote: Try recording a macro when you change the selected cell's fill color. Then stop recording. Then add a commandbutton from the control toolbar toolbox to the worksheet. Double click on that commandbutton and you'll see where you want to move the code. Then delete the original recorded macro. When you're done, you should end up with a routine that looks like: Option Explicit Private Sub CommandButton1_Click() Selection.Interior.ColorIndex = 35 End Sub The number will depend on what color you use. xavi garriga wrote: Hi to all! Here you have another question about a macro... I need to change the fill color of some cells by clicking a command button. I've searched VB help but I haven0t found anything. If anyone knows the correct code please write it... Thanks to all! -- atrep -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command Button | Excel Discussion (Misc queries) | |||
command button | Excel Worksheet Functions | |||
Command Button | Excel Worksheet Functions | |||
command button | Excel Discussion (Misc queries) | |||
command button | Excel Discussion (Misc queries) |