LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Formatting cells with VB

Hi -

I have a long string of code that basically goes through each row and
determines a color for it based on a few variables. [Training Classes;
Completed, Cancelled and Segregate by Class Date] There are several tabs for
different customers and the third pass for color changes based customer tab.
The best way I could think of doing this was Run through the worksheet three
times:

First Pass: If some text is Like "*Complete*" Set the row color to gray
Second Pass: If class end date and customer name change then Set row color =
#
Third Pass: If some text is Like "*CANCELLED*" Set the row color to red

What this does is create blocks of colors for each class which may have
grayed lines in them or not. The top row a new class with the second pass. I
need to bold the second pass row which I can do simply enough but how do I
also set a set a border around each instance [or training class] of the color
with the second pass?

Sheets("Customer1").Select
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=6, Criteria1:="=1/1/2008", Operator:=xlAnd
Range("L2").Select
Selection.End(xlDown).Select
ActiveCell.Select
ActiveCell.Offset(1, -1).Activate
ActiveCell.FormulaR1C1 = "999"
ActiveCell.Offset(0, -5).Activate
ActiveCell.FormulaR1C1 = "stop"
Range("K2").Select

Do Until ActiveCell = "999"

If ActiveCell.Value Like "*complete*" Then
Selection.EntireRow.Interior.ColorIndex = 15
ActiveCell.Offset(1, 0).Activate

Else
If ActiveCell.Offset(1, 0) = Null Then
ActiveCell.Offset(1, 0).Activate

Else: ActiveCell.Offset(1, 0).Activate

End If
End If
Loop

Range("F2").Select

Do Until ActiveCell = "stop"

If ActiveCell = ActiveCell.Offset(1, 0) And ActiveCell.Offset(0, -2) =
ActiveCell.Offset(1, -2) Then
ActiveCell.Offset(1, 0).Activate

Else
If ActiveCell.Offset(1, 0) = Null Then
ActiveCell.Offset(1, 0).Activate

Else: ActiveCell.Offset(1, 0).EntireRow.Interior.ColorIndex = 37
ActiveCell.Offset(1, 0).Activate

End If
End If
Loop

Range("K2").Select

Do Until ActiveCell = "999"

If ActiveCell.Value Like "*CANCELLED*" Or ActiveCell.Value Like "*NOT
FUNDED" Then
Selection.EntireRow.Interior.ColorIndex = 3
ActiveCell.Offset(1, 0).Activate

Else
If ActiveCell.Offset(1, 0) = Null Then
ActiveCell.Offset(1, 0).Activate

Else: ActiveCell.Offset(1, 0).Activate

End If
End If
Loop

Columns("M:M").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Interior.ColorIndex = xlNone
Range("a1").Select


Any Ideas would be greatly appreciated.
Carrie

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1

 
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
condionally formatting based on another cells formatting? Derrick Excel Discussion (Misc queries) 2 July 31st 09 08:05 PM
conditionally formatting cells based on other cells Derrick Excel Discussion (Misc queries) 1 July 7th 09 09:43 PM
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
How can I have formatting options like merge cells ,Bold,active for the unlocked cells of the protected worksheet.Is it possible in excel? divya Excel Programming 2 July 20th 06 02:04 PM
Conditional Formatting Multiple cells based on 2 cells Louis Markowski Excel Worksheet Functions 2 June 1st 05 05:26 PM


All times are GMT +1. The time now is 03:28 AM.

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

About Us

"It's about Microsoft Excel"