pjandshelly
Board Regular
- Joined
- Jan 25, 2017
- Messages
- 61
First off, I would like to start that I have very little VBA experience. I had an issue and looked this up online. I have a workbook that has a cover sheet to it. On the cover sheet, there are 30 reports that I must complete. On the cover sheet also, I have a value that I change for each worksheet that is a 1 or 0 for each report. Every week, I am responsible for updating the different tabs data report. Some of the tabs do not need to be updated weekly. I would like a VBA code to change the color of the tab based off the 1 or 0 value. I found this link online and tried to replicate the code, but it isn't working. https://www.extendoffice.com/documents/excel/4090-excel-color-tab-based-on-cell-value.html#a2
In the VBA screen, I am clicking on the Cover sheet in the Microsoft Excel Objects. Then pasting this code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'Updateby Extendoffice 20160930
Select Case Sheets("Cover").Range("F6").Value
Case "1"
Sheets("NLT%Appts").Tab.Color = vbGreen
Case "0"
Sheets("NLT%Appts").Tab.Color = vbRed
Case "KTW"
End Select
Select Case Sheets("Cover").Range("G6").Value
Case "1"
Sheets("TIU%Unsigned").Tab.Color = vbGreen
Case "0"
Sheets("TIU%Unsigned").Tab.Color = vbRed
Case "KTW"
End Select
End Sub
I would continue this script until I get the 30 tabs completed. Then save the worksheet as XLSM.
Can anyone point me to my error?
In the VBA screen, I am clicking on the Cover sheet in the Microsoft Excel Objects. Then pasting this code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'Updateby Extendoffice 20160930
Select Case Sheets("Cover").Range("F6").Value
Case "1"
Sheets("NLT%Appts").Tab.Color = vbGreen
Case "0"
Sheets("NLT%Appts").Tab.Color = vbRed
Case "KTW"
End Select
Select Case Sheets("Cover").Range("G6").Value
Case "1"
Sheets("TIU%Unsigned").Tab.Color = vbGreen
Case "0"
Sheets("TIU%Unsigned").Tab.Color = vbRed
Case "KTW"
End Select
End Sub
I would continue this script until I get the 30 tabs completed. Then save the worksheet as XLSM.
Can anyone point me to my error?