Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
Change color of font base on time range deathzorro Excel Discussion (Misc queries) 2 January 10th 06 07:58 AM
How to change the default Border, Font Color, and Cell Color Elijah Excel Discussion (Misc queries) 3 November 2nd 05 11:52 PM
Sumif and base it on font color of cell Bruce Excel Worksheet Functions 1 September 28th 05 10:52 PM
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"