PC Review


Reply
Thread Tools Rate Thread

Conditional Tab Colors

 
 
Ray
Guest
Posts: n/a
 
      29th Jul 2009
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
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      29th Jul 2009
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" <(E-Mail Removed)> wrote in message
news:f1b9262c-8134-490a-bf92-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Lars-Åke Aspelin
Guest
Posts: n/a
 
      29th Jul 2009
On Wed, 29 Jul 2009 14:27:30 -0400, "Rick Rothstein"
<(E-Mail Removed)> 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 With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      29th Jul 2009
Good point! Thanks for picking up on that.

--
Rick (MVP - Excel)


"Lars-Åke Aspelin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Wed, 29 Jul 2009 14:27:30 -0400, "Rick Rothstein"
> <(E-Mail Removed)> 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 With Quote
 
Ray
Guest
Posts: n/a
 
      29th Jul 2009
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"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
> Good point! Thanks for picking up on that.
>
> --
> Rick (MVP - Excel)
>
> "Lars-Åke Aspelin" <lar...@REMOOOVE.telia.com> wrote in message
>
> news:(E-Mail Removed)...
>
> > On Wed, 29 Jul 2009 14:27:30 -0400, "Rick Rothstein"
> > <rick.newsNO.S...@NO.SPAMverizon.net> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
more colors on conditional format deb Microsoft Access 9 15th Sep 2009 03:02 AM
Conditional Colors for Charts If Microsoft Excel Charting 0 29th May 2006 05:45 PM
Conditional Tab Colors Mike Williquette Microsoft Excel Worksheet Functions 0 2nd Dec 2003 05:15 PM
Conditional Colors L Manios Microsoft Access Reports 3 9th Nov 2003 04:43 PM
conditional formatting (colors) _Bigred Microsoft Access Reports 1 18th Sep 2003 02:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 PM.