Control Box assigned to multiple spreadsheets

  • Thread starter Thread starter LUKEMUDGE
  • Start date Start date
L

LUKEMUDGE

I have the VB script to change the background color of my cells working but I
would like it to change another cell in a different worksheet. Can anybody
help me out with how to program the reference?

Here is the VB script I'm using to change the colors at the moment

Range("C5").Interior.ColorIndex = -4138 - Range("C5").Interior.ColorIndex
 
Hi
With Worksheets("MyOtherSheet")
.Range("C5").Interior.ColorIndex = -4138 - .Range
("C5").Interior.ColorIndex
End with

note the period in front of both Range.
If you want to do it on all sheets

Dim ws as worksheet
For each ws in Activeworkbook.Worksheets
With ws
.Range("C5").Interior.ColorIndex = -4138 - .Range
("C5").Interior.ColorIndex
End with

regards
Paul
 
Back
Top