Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey,
I need a VBA code that count the number of times "cf" occurs in the 14 cells to the left of every cell, including the cell, in a range and change the bottom border line to a thick red line if the count exceeds 4. What I'm trying to do is point out if someone has been scheduled "cf" more than 4 times in the past 14 days. Is this possible at all? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since you did not specify the columns and rows, I used columns A thru O,
with O being the one that holds the criteria to identify which rows to count the "cf" in. You can alter the macro to suit your actual sheet content. Sub dk() Dim lr As Long, sh As Worksheet Dim rng As Range, fRng As Range, c As Range Set sh = ActiveSheet lr = sh.Cells(Rows.Count, 15).End(xlUp).Row Set rng = sh.Range("O2:O" & lr) For Each c In rng Set fRng = sh.Range("A" & c.Row & ":O" & c.Row) If WorksheetFunction.CountIf(fRng, "cf") 4 Then With fRng.Borders(xlEdgeBottom) .LineStyle = Solid .Weight = xlThick .ColorIndex = 3 End With End If Next End Sub "roster_jon" wrote in message ... Hey, I need a VBA code that count the number of times "cf" occurs in the 14 cells to the left of every cell, including the cell, in a range and change the bottom border line to a thick red line if the count exceeds 4. What I'm trying to do is point out if someone has been scheduled "cf" more than 4 times in the past 14 days. Is this possible at all? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Resize Table Range to exclude zero values and Input New Range into achart object | Excel Programming | |||
resize range | Excel Programming | |||
Set new range based on rng.Offset(rng.Rows.Count, 0).Resize(1, 1) | Excel Programming | |||
Range.Delete and Range.Resize.Name performance issues | Excel Programming | |||
Range Resize | Excel Programming |