Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: 22 Jan 2006 13:07:16 -0800,    group: microsoft.public.word.vba.customization        back       


Changing the Sheet tab color   
To whom every can help:

I have 1 sheet per tenant with their information and X amount of
tenants. The 4 cells that the macro looks at in each sheet are
different dates. For example Lease End Date is one of them. So 1st part
of the If is if the date of the lease end is today or past today make
the sheet tab Red. If its today +30 make it yellow so i know the lease
is ending. If its neither it makes it white.  If one cell is true the
loop stops and jumps to the next sheet

Code:
Sub test()

Dim ws As Worksheet, rng
rng = Array(13, 16, 22, 27)
For Each ws In Worksheets
x = Application.Match(ws.Name, Array("AT&T Lease", "as"), 0)
If Not IsError(x) Then
With ws
For i = 0 To UBound(rng)
flag = False
Select Case .Range("b" & rng(i)).Value
     Case Is <= Date
           ''''''.Tab.ColorIndex = 3
            Application.Run ("TabRed"): flag = True
     Case Is < Date + 30
          ''''''.Tab.ColorIndex = 6
          Application.Run ("TabYellow"): flag = True
     Case Else
          ''''' .Tab.ColorIndex = -4142
          Application.Run ("TabWhite"): flag = False
End Select
If flag Then Exit For
Next
End With
End If
Next
End Sub
[/Code]

The application "TabRed" is: ActiveWorkbook.Sheets("AT&T
Lease").Tab.ColorIndex = 3

I think "TabRed" is code i need to change to make this all work
correctly. But i tried to insert: ".Tab.ColorIndex = 3" instead and it
error's on me.

Is there any way to say change the sheet tab color that the loop is on
and not specify a sheet?

Thanks everyone in advance.
date: 22 Jan 2006 13:07:16 -0800   author:   Leon

Re: Changing the Sheet tab color   
Hi Leon, 

> I have 1 sheet per tenant with their information and X amount of
> tenants.
>
I think you meant to post this in excel.programming?

You might run across someone in this group 
(word.vba.customization) that can help you, but you're more likely 
to get a quick and useful response in the Excel group :-)

    Cindy Meister
date: Tue, 24 Jan 2006 16:27:36 +0100   author:   Cindy M -WordMVP-

Re: Changing the Sheet tab color   
Ok Thanks Cindy
date: 24 Jan 2006 23:53:27 -0800   author:   Leon

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us