Macro to set cell interior color?

I

imoose

I'd like to create a macro that will fill the current cell (or cells) with
whatever the current fill color is.

I tried to record a macro to do this, but it always fills the cell with the
color that was current when the macro was recorded.

Perhaps I could modify that macro in the VBA editor ... but I don't know
what value to use for the color index.

Any help is greatly appreciated.
 
D

Don Guillett

Search for a color index table or record a macro with the color you want to
see.
 
I

imoose

Actually, the behavior I was hoping to create was for me to be able to set
the color in the Fill Color picker, and then, as I'm entering data in cells,
to be able to keep my hands on the keyboard and use the macro key-combo to
color the cells as I go.

BUT ALSO that, if I change the Fill Color in the picker, the macro will then
use the new ("current") color.

So, I guess I want to know how to make a macro that will fill the cell with
whatever is the "current" color in the Fill Color picker.

Is that even possible?
imoose
 
D

Don Guillett

How about a vlookup table with
yellow 6
blue 5
etc
cell d2 data>validation>list>select e3:e and your end of list
in cell e2 =vlookup(d2,e3:e23,2,0)
OR JUST PUT A COLOR IN CELL E2 FROM THE PICKER.
then right click sheet tab>view code>insert the code below
Now when you change a cell in f2:f5 the color in e2 will be used.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("f2:f5")) Is Nothing Then Exit Sub
Target.Interior.ColorIndex = Range("e2")

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top