VB Question

G

GlenS18

I have been sent this little ditty. Apparently it allows you to tur
cells a certain colour depending on the value entered in it
Conditional formatting does not only limits you to 3 choices.

Can anyone explain it to me & how to get started as I have not used th
VB part of Excel much.

Many thanks.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B7:U29")) Is Nothing Then
Select Case Target.Text
Case Is = "H"
Target.Interior.ColorIndex = 3
Case Is = "M"
Target.Interior.ColorIndex = 45
Case Is = "L"
Target.Interior.ColorIndex = 6
Case Is = "U"
Target.Interior.ColorIndex = 41
Case Is = "N"
Target.Interior.ColorIndex = 50
Case Else
Target.Interior.ColorIndex = xlNone
End Select
End If
End Su
 
I

icestationzbra

if i understand your question right, i think you want to know how to ge
this code into the right place and to get it to work.

right click on the tab a sheet.

choose View Code. vba code window opens.

from the left pane, select the sheet to which this range B7:U2
belongs.

copy your code and paste it in the right side pane.

you are good to go. enter, say H, in a cell within B7:U29, and yo
should see the colour change to that specified in the macro (red).

revert if i misunderstood your question
 

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