Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveWorkbook.Sheets("TEST").Tab.ColorIndex = 3

Status
Not open for further replies.

newuser08

Technical User
Feb 12, 2008
29
GB
Not use where to start.

Firstly can I say I ‘m a completed newb to excel vba so please go easy on me.

In sheet1 I have a validation cell (A1 “Validation”) when True=1 else blank.

I’m wanting to change the sheet tab colour to… err Red if Validation=1.

Any suggestions… please try to keep them simple ish.

Thanks
 
Well, do you want this to happen on the cell change , or when the user opens a workbook ? or other way

eitehr way , you are going need to put your code in that event.

You are going to need a test condition as you described above,

you are then going to need the code to change your sheet tab colour. Have you recorded a macro and looked at the VBA ?

Chance,

F, G + 2MSTG
 
I would like in on a 'on open event'
I did record a macro and tried:


'##########################################

Private Sub Workbook_Open()

If Sheet10("Validation", 1) Then

Sheets("TEST").Select
ActiveWorkbook.Sheets("TEST").Tab.ColorIndex = 3

Else

Sheets("TEST").Select
ActiveWorkbook.Sheets("TEST").Tab.ColorIndex = 1

End If
End Sub

As you can imagine it fell over.

Suggestions??
 
Code:
If Sheet1.Range("valid").Value = 1 Then

    Sheet1.Tab.ColorIndex = 3
Else
    Sheet1.Tab.ColorIndex = 1
End If



Chance,

F, G + 2MSTG
 
Is it possible to make the above work in a shared excel book?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top