Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Conditional Tab Colors

Hi -

I'd like a short procedure to loop through a set number of worksheets
(named 1 to 31), testing for the existence of ANY data in cell D3 (on
each sheet) ... if NO DATA exists, the tab color should be changed to
Red.

This procedure will be used on computers running XP and XL02 ...

Any help is greatly appreciated!

Thanks,
Ray
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Conditional Tab Colors

Give this macro a try...

Sub CheckCellD3()
Dim WS As Worksheet
For Each WS In Worksheets
If WS.Range("D3").Value = "" Then
WS.Tab.ColorIndex = 3
Else
WS.Tab.ColorIndex = xlNone
End If
Next
End Sub

--
Rick (MVP - Excel)


"Ray" wrote in message
...
Hi -

I'd like a short procedure to loop through a set number of worksheets
(named 1 to 31), testing for the existence of ANY data in cell D3 (on
each sheet) ... if NO DATA exists, the tab color should be changed to
Red.

This procedure will be used on computers running XP and XL02 ...

Any help is greatly appreciated!

Thanks,
Ray


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default Conditional Tab Colors

On Wed, 29 Jul 2009 14:27:30 -0400, "Rick Rothstein"
wrote:

Give this macro a try...

Sub CheckCellD3()
Dim WS As Worksheet
For Each WS In Worksheets
If WS.Range("D3").Value = "" Then
WS.Tab.ColorIndex = 3
Else
WS.Tab.ColorIndex = xlNone
End If
Next
End Sub


And if you have other sheets in the workbook besides sheets 1,2,3,..31
that you don't want to include in this check you may replace the

For Each WS in Worksheets

with

For i = 1 to 31
Set WS = Worksheets(""&i)

Hope this helps / Lars-Åke


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Conditional Tab Colors

Good point! Thanks for picking up on that.

--
Rick (MVP - Excel)


"Lars-Åke Aspelin" wrote in message
...
On Wed, 29 Jul 2009 14:27:30 -0400, "Rick Rothstein"
wrote:

Give this macro a try...

Sub CheckCellD3()
Dim WS As Worksheet
For Each WS In Worksheets
If WS.Range("D3").Value = "" Then
WS.Tab.ColorIndex = 3
Else
WS.Tab.ColorIndex = xlNone
End If
Next
End Sub


And if you have other sheets in the workbook besides sheets 1,2,3,..31
that you don't want to include in this check you may replace the

For Each WS in Worksheets

with

For i = 1 to 31
Set WS = Worksheets(""&i)

Hope this helps / Lars-Åke



  #5   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Conditional Tab Colors

Rick & Lars-Åke -

Thanks very much ... worked perfectly! and I DID have more than just
the Sheets titled 1-31, so Lars-Åke's suggestion was definitely
useful!

//ray


On Jul 29, 2:52*pm, "Rick Rothstein"
wrote:
Good point! Thanks for picking up on that.

--
Rick (MVP - Excel)

"Lars-Åke Aspelin" wrote in message

...

On Wed, 29 Jul 2009 14:27:30 -0400, "Rick Rothstein"
wrote:


Give this macro a try...


Sub CheckCellD3()
*Dim WS As Worksheet
*For Each WS In Worksheets
* *If WS.Range("D3").Value = "" Then
* * *WS.Tab.ColorIndex = 3
* *Else
* * *WS.Tab.ColorIndex = xlNone
* *End If
*Next
End Sub


And if you have other sheets in the workbook besides sheets 1,2,3,..31
that you don't want to include in this check you may replace the


For Each WS in Worksheets


with


For i = 1 to 31
Set WS = Worksheets(""&i)


Hope this helps / Lars-Åke


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
Conditional Statements looking at colors? taurus99 Excel Discussion (Misc queries) 3 February 20th 09 01:32 PM
Conditional Colors in a CELL binar[_2_] Excel Discussion (Misc queries) 2 January 22nd 09 12:46 PM
conditional text colors Paul B[_4_] Excel Discussion (Misc queries) 2 February 1st 08 04:42 PM
Conditional Colors for Charts If Charts and Charting in Excel 0 May 29th 06 06:45 PM
Conditional Colors for Charts If Charts and Charting in Excel 0 May 29th 06 05:45 PM


All times are GMT +1. The time now is 08:19 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"