Control Box assigned to multiple spreadsheets

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
 
P

paul.robinson

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
 

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