Highlights

W

Wahab

I want to Highlight more than five brand name with
different colors in my complete workbook. Lets say when I
type Brand1 it will make the cell background in Red, for
Brand2 = Green, Brand 3=Blue, Brand4=Pink and Brand 5 =
DarkRed. How I will write the code for this one. Or how
can I write Select case in Excel?
Please reply urgently
Thanks and regards
Waahab
 
A

acw

Waha

In the worksheet module put the following code

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range

Select Case Target.Valu
Case "Brand1
Target.Interior.ColorIndex =
Case "Brand2
Target.Interior.ColorIndex =
Case "Brand3
Target.Interior.ColorIndex =
Case "Brand4
Target.Interior.ColorIndex =
Case "Brand5
Target.Interior.ColorIndex =
Case Els
Target.Interior.ColorIndex = xlNon
End Selec
End Su

You may want to modify the colorindex values to suit. Note also that this is case sensitive. Brand1 will work, but brand1 will not

Ton

----- Wahab wrote: ----

I want to Highlight more than five brand name with
different colors in my complete workbook. Lets say when I
type Brand1 it will make the cell background in Red, for
Brand2 = Green, Brand 3=Blue, Brand4=Pink and Brand 5 =
DarkRed. How I will write the code for this one. Or how
can I write Select case in Excel
Please reply urgentl
Thanks and regard
Waaha
 
G

Guest

-----Original Message-----
I want to Highlight more than five brand name with
different colors in my complete workbook. Lets say when I
type Brand1 it will make the cell background in Red, for
Brand2 = Green, Brand 3=Blue, Brand4=Pink and Brand 5 =
DarkRed. How I will write the code for this one. Or how
can I write Select case in Excel?
Please reply urgently
Thanks and regards
Waahab

.
Thank you Mr. Tony , Is there any way that it will work
same like in MS Access after update, I mean when I update
the cellvalue same time it'll make the background color
to? In that case I dont have to move my cell around.
Thank you very much.
Wahab
 
A

acw

Wahab

If you put the code into the worksheet module, then when the data is entered, the cell background will immeditately update. To put it into a worksheet module, right click on the sheet tab, pick view code and put the code in there.


Tony

----- [email protected] wrote: -----

-----Original Message-----
I want to Highlight more than five brand name with
different colors in my complete workbook. Lets say when I
type Brand1 it will make the cell background in Red, for
Brand2 = Green, Brand 3=Blue, Brand4=Pink and Brand 5 =
DarkRed. How I will write the code for this one. Or how
can I write Select case in Excel?
Please reply urgently
Thanks and regards
Waahab
Thank you Mr. Tony , Is there any way that it will work
same like in MS Access after update, I mean when I update
the cellvalue same time it'll make the background color
to? In that case I dont have to move my cell around.
Thank you very much.
Wahab
 
Top