Count number of consecutive cells in a row which meet array criteria

Vincent88

Active Member
Joined
Mar 5, 2021
Messages
382
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
Hi Guys,
I want to highlight those consecutive cells (till the end of that month only) in a row which meet the criteria in array. (Those cells with yellow highlight). Please help how to have the correct code to complete this task. I searched the web but with no luck to find any similarity to modifty.

TestDropDownList_2.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAI
1MDateAttendance27-Jan28-Jan29-Jan30-Jan31-Jan1-Feb2-Feb3-Feb4-Feb5-Feb6-Feb7-Feb8-Feb9-Feb10-Feb11-Feb12-Feb13-Feb14-Feb15-Feb16-Feb17-Feb18-Feb19-Feb20-Feb21-Feb22-Feb23-Feb24-Feb25-Feb26-Feb27-Feb28-Feb
2DateSummary(5)(4)(3)(2)(1)12345678910111213141516171819202122232425262728
3Larry QT:16 L:0.5 D:2.5 E:0 N:0DD2KGGGGDND1D3DGENNAMNNNDKKDDD2D2
4Mandy HT:16 L:0.5 D:3.5 E:0 N:0D2DDDDKDKKKEEEEEDD1KENNNALALDDD D
202202
Cells with Data Validation
CellAllowCriteria
A2List=Data!$P$2:$P14
A3List=Data!$P$2:$P$14
A4List=Data!$P$2:$P$13


VBA Code:
Sub cellsOverFive()

Dim ws As Worksheet
Set ws = ActiveSheet


Dim C As Range, rng As Range, rng1 As Range
Dim tArray As Variant
Set tArray = [("D","D1","D2","D3","D4","D5","G"."K","E","N")]

Application.DisplayStatusBar = False
Application.EnableEvents = False
Application.ScreenUpdating = False


Set rng = ws.Range("C3", ws.Range("AL" & Rows.Count).End(xlUp))

With rng.Cells
    .Interior.xlPatternNone
End With

For Each C In rng
        
        
Next C
      

Application.DisplayStatusBar = True
Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I mean any consecutive cells more than 5 which meets any of the value in array then highlight them.
 
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,857
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top