Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
change tab color base on cell value
I would like to change the worksheet tab color to red if a date exist in cell
N13. I would like to set this up for the entire workbook, because new worksheet can be added at any time. Please keep in mind that I'm not a VB programmer. Thanks for any input. G. Wolfe |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
change tab color base on cell value
Hi G
Locate the ThisWorkbook module in the VB editor (Alt F11 or similar) and paste this in: Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address = "$N$13" Then If IsDate(Target.Value) Then Sh.Tab.ColorIndex = 3 End If End Sub Assuming that the date is typed or pasted, and that removing red is not needed when the date is deleted. HTH. Best wishes Harald "G. Wolfe" <G. skrev i melding ... I would like to change the worksheet tab color to red if a date exist in cell N13. I would like to set this up for the entire workbook, because new worksheet can be added at any time. Please keep in mind that I'm not a VB programmer. Thanks for any input. G. Wolfe |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
change tab color base on cell value
Hi Harald,
That worked great. Thank You. Upon further review. Would it be possible to have the tab color red if the cell is empty, then remove the color once a date is placed in the cell. Thanks again. G. Wolfe "Harald Staff" wrote: Hi G Locate the ThisWorkbook module in the VB editor (Alt F11 or similar) and paste this in: Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address = "$N$13" Then If IsDate(Target.Value) Then Sh.Tab.ColorIndex = 3 End If End Sub Assuming that the date is typed or pasted, and that removing red is not needed when the date is deleted. HTH. Best wishes Harald "G. Wolfe" <G. skrev i melding ... I would like to change the worksheet tab color to red if a date exist in cell N13. I would like to set this up for the entire workbook, because new worksheet can be added at any time. Please keep in mind that I'm not a VB programmer. Thanks for any input. G. Wolfe |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
change tab color base on cell value
Yes. The coloring technique is the very same, with just a different
colorindex, upon date entry. Problem is; who'll color the tabs red in the first place ? Worksheets will be added, as you say. Note also that colored sheet tabs came with Excel XP and code like this will err on Excel 2000 and earlier. Which may not be a problem in your environment, but just to make sure you know this potential problem... HTH. Best wishes Harald "G. Wolfe" skrev i melding ... Hi Harald, That worked great. Thank You. Upon further review. Would it be possible to have the tab color red if the cell is empty, then remove the color once a date is placed in the cell. Thanks again. G. Wolfe "Harald Staff" wrote: Hi G Locate the ThisWorkbook module in the VB editor (Alt F11 or similar) and paste this in: Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address = "$N$13" Then If IsDate(Target.Value) Then Sh.Tab.ColorIndex = 3 End If End Sub Assuming that the date is typed or pasted, and that removing red is not needed when the date is deleted. HTH. Best wishes Harald "G. Wolfe" <G. skrev i melding ... I would like to change the worksheet tab color to red if a date exist in cell N13. I would like to set this up for the entire workbook, because new worksheet can be added at any time. Please keep in mind that I'm not a VB programmer. Thanks for any input. G. Wolfe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel: Syntax to change cell color based on color of another cell | Excel Worksheet Functions | |||
Change color of font base on time range | Excel Discussion (Misc queries) | |||
How to change the default Border, Font Color, and Cell Color | Excel Discussion (Misc queries) | |||
Sumif and base it on font color of cell | Excel Worksheet Functions | |||
Browse Forms Controls and change TextBox color based on cell color | Excel Programming |