Changing worksheet backgrounds from one control sheet

S

Skie

Hi All,

I am trying to have the background of multiple worksheets change based
on the entry of a field on a master page that matches a list I have
(in the vba already). Each "team" has its own colour scheme, and each
worksheet has a range defined that I want to colour (in the below
example example 'Audit')

I already have the below code in each worksheet and it works but only
on the master sheet, the other sheets dont update. I also tried
linking a cell on each workbook to the master field and pointing it to
those, but that dosent work, the vba still only changes a sheet when
the sheet itself is changed by hand. I am probably missing something
*really* simple but am a relative novice to vba.

The "team" range below is on the master sheet and is just one cell
where a user can enter the team name to change the sheets colour.
"Audit" is the range of cells on the sheet I want to change the colour
of, there are different ranges on each sheet, hence why I have
multiple instances of the code (one on each worksheet to be changed)

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Range("Team")) Is Nothing Then
With Target
Select Case .Value
Case "Liverpool": Range("Audit").Interior.ColorIndex
= 19
Case "Leeds": Range("Audit").Interior.ColorIndex = 13
Case "Glasgow": Range("Audit").Interior.ColorIndex =
35
Case "Central London": Range
("Audit").Interior.ColorIndex = 17
Case "West London": Range
("Audit").Interior.ColorIndex = 38
Case "Solihull": Range("Audit").Interior.ColorIndex =
37
Case "Cardiff": Range("Audit").Interior.ColorIndex =
45
End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub


Any help is much appreciated!
 

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