Find a color value

S

Scott

G’Day,

I have a worksheet which users can change the color of a particular cell –
assume C3. What I want to do is change the color of another worksheet tab
(within the same workbook) to match the cell color of C3.

Can anyone help?

Cheers

Scott
 
H

Héctor Miguel

hi, Scott !
I have a worksheet which users can change the color of a particular cell assume C3.
What I want to do is change the color of another worksheet tab (within the same workbook) to match the cell color of C3.

assuming the "other" worksheet is "Sheet2", put this code into C3 cell's source sheet (code module)...
(note you will need '_selectionchange' event to be triggered and excel version 2002/xp or above)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myColor As Integer
myColor = Range("c3").Interior.ColorIndex
With Worksheets("sheet2").Tab
If .ColorIndex <> myColor Then .ColorIndex = myColor
End With
End Sub

hth,
hector.
 
S

Scott

Hector,

Thanks for the response. I tried this but unfortunately i get the error
"run-time error 438 Object doesn't support this property or method" and then
the VB Editor highlights the code line:
With Worksheets("sheet2").Tab

I tried renaming the sheet "Sheet2" in case the capital made a difference
and tried different sheets, but all with no luck.

I am running Excel 2000.

Appreciate your help

Scott
 
H

Héctor Miguel

hi, Scott !
... i get the error "run-time error 438 Object doesn't support this property or method"
and then the VB Editor highlights the code line:
With Worksheets("sheet2").Tab
(...)
I am running Excel 2000.

I think you missed this part from my proposal...

(I'm sorry but xl-2000 doesn't support tab color changes)

regards,
hector.
 
S

Scott

Hectoe,

Thx for your time, I am sorry I miss understood - I thought I needed to a
selectchange event IF it was excel 2002+ not AND.

Again thanks fro your time

Scott
 

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