Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to set the active tab color. In the attached document I tried to follow instructions below and seem to not be able to get it work. Any suggestions on how to set the variable values it discusses below.
First create a variable say vThisTab and set its value to 0.
Second go to Sheet Properties, Triggers, OnActivateSheet, Add Action, External, Set Variable, vThisTab, 1
Third, OnLeaveSheet, Set Variable, vThisTab, 0
Fourth, Sheet Properties, General, Tab Settings, Custom Colors, click on the Tab Color, Base Color, select Calculated and set the following conditional
If($(vThisTab) = 1, RGB(255, 0, 0), RGB(0, 255, 0))
Hi,
I created an app with that logic.
Please, check my attachment.
On each tab, check on the general properties -> tab colors
also, check the triggers on all of them .
Hope this helps,
Erich
Hi
I think it will be hard tii get that method to work, since leaving a tab does not leave any trace.
I solved it by using a macro:
Set activeSheet = ActiveDocument.ActiveSheet
Sub SetTabColor
'Set old sheet color back
If (not isnull(activeSheet)) Then
Set sp=activeSheet.GetProperties
sp.TabAttr.Mode = 1 ' Sheet colors
activeSheet.SetProperties sp
end if'Now, save the new sheet
Set activeSheet = ActiveDocument.ActiveSheet'And set the new tab color
Set sp=activeSheet.GetProperties
sp.TabAttr.BgColor.PrimaryCol.Col = RGB(255,0,0)
sp.TabAttr.Mode = 2 ' custom colors
activeSheet.SetProperties sp
End Sub
And then every tab need to call this makro in the OnActivateSheet trigger.
Hi,
I created an app with that logic.
Please, check my attachment.
On each tab, check on the general properties -> tab colors
also, check the triggers on all of them .
Hope this helps,
Erich
Great idea, Erich!
I created a video on YouTube to show how to do the same
I hope it helps
Please share it if it works for you
This works, and does exactly what I wanted it to do. Thanks, erich.shiino!
I think it is better to use GetActiveSheetId() instead of variables. No need for sheet actions then.
Could you get this work on web view or access point?