Chowmann78
New Member
- Joined
- Dec 7, 2020
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hi,
I have uses this forum for years and for the first time can't find the exact answer I need so I am hoping someone can point me in the right direction!
This is my formula which checks a range (E4:TH15) in sheet1 and finds the color in K1 and value/text in K2 and then returns the count of these two conditions in to the cell to the left of K2.
Hope I have explained this well?
What I need is for the VBA to check all the cells in column K (K2, K3, K4....) and return the value in the adjacent left cell in each row until a blank cell is found in column K.
Sub CountColorValue()
Dim numbers As Long
Dim Cell As Range
For Each Cell In Sheet1.Range("E4:TH15")
If Cell.Interior.ColorIndex = Range("K1").Interior.ColorIndex Then
If Cell.Value Like Range("K2").Value Then
numbers = numbers + 1
End If
End If
Next Cell
Cells(2, 10).Value = numbers
End Sub
Someone has probably posted this here somewhere but I Just can't find it or figure out what I need to do.
Thanks in advance.
I have uses this forum for years and for the first time can't find the exact answer I need so I am hoping someone can point me in the right direction!
This is my formula which checks a range (E4:TH15) in sheet1 and finds the color in K1 and value/text in K2 and then returns the count of these two conditions in to the cell to the left of K2.
Hope I have explained this well?
What I need is for the VBA to check all the cells in column K (K2, K3, K4....) and return the value in the adjacent left cell in each row until a blank cell is found in column K.
Sub CountColorValue()
Dim numbers As Long
Dim Cell As Range
For Each Cell In Sheet1.Range("E4:TH15")
If Cell.Interior.ColorIndex = Range("K1").Interior.ColorIndex Then
If Cell.Value Like Range("K2").Value Then
numbers = numbers + 1
End If
End If
Next Cell
Cells(2, 10).Value = numbers
End Sub
Someone has probably posted this here somewhere but I Just can't find it or figure out what I need to do.
Thanks in advance.