Excel VBA Macro: Count and List the Number of (Conditonally Formatted) Cells at the End of Each Row

  Рет қаралды 1,201

greggowaffles

greggowaffles

Жыл бұрын

Excel VBA Macro: Count and List the Number of (Conditonally Formatted) Cells at the End of Each Row
💥Subscribe: / @greggowaffles
This is a modification of code from:
www.excelsirji.com/vba-code-c...
Code:
Sub list_cond_cells_per_row()
Dim rng As Range
Dim rngCell As Range
Dim row_count As Integer
Dim col_count As Integer
Dim cond_count As Integer
Dim i As Integer
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
ws.Activate
row_count = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlDown)))
col_count = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlToRight)))
For i = 2 To row_count
Set rng = ws.Range(Cells(i, 1), Cells(i, col_count))
cond_count = 0
For Each rngCell In rng
If Cells(rngCell.Row, rngCell.Column).DisplayFormat. _
Interior.Color = RGB(255, 199, 206) Then
cond_count = cond_count + 1
End If
Next
ws.Cells(i, col_count + 1) = cond_count
Next i
End Sub
#ExcelVBA #ExcelMacro

Пікірлер: 3
@coolvideos4562
@coolvideos4562 6 ай бұрын
I have 1 year data but how to Filter one month data automatically Using VBA paste to new sheet
@kameya1104
@kameya1104 Жыл бұрын
I used lo do for loop for this kind of procedure, but now I prefer to use Do Until... i.e. Do Until Range("A" & i)="", then eliminate one extra variable like row_count.
@greggowaffles
@greggowaffles Жыл бұрын
Thanks for sharing that!!
Do You Need to SWITCH from Excel VBA Macros to Office Scripts?
13:02
Leila Gharani
Рет қаралды 377 М.
WHAT’S THAT?
00:27
Natan por Aí
Рет қаралды 14 МЛН
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 21 МЛН
Jumping off balcony pulls her tooth! 🫣🦷
01:00
Justin Flom
Рет қаралды 13 МЛН
Conditionally format so the coloured cells can be counted in Excel
10:26
How to Get List of File Names in a Folder using Excel
5:40
Excel Weez
Рет қаралды 6 М.
Excel VBA Macro: Delete Rows (Based on List of Values)
12:22
greggowaffles
Рет қаралды 606
Next Empty Row Trick in Excel VBA & Macros
10:36
TeachExcel
Рет қаралды 53 М.
VBA Macro to Delete Rows Based on Cell Values
9:32
Excel Campus - Jon
Рет қаралды 139 М.
10 awesome Power Query tricks you NEED to know! | Excel Off The Grid
15:44
Excel Off The Grid
Рет қаралды 34 М.
Excel VBA Loop Through Rows in a Table or Range
7:15
SyntaxByte
Рет қаралды 37 М.