Anbuselvam K
Member
Hi
The below linked excel file Module1, I have a below code to find out the Yellow highlighted cells without any values in that,
After finding those cells I need to check each highlighted cells intersect column "A" Value (Date) and then it has to check those dates in another sheet then respective RM2 to RM52 has to sum up the values in the highlighted cells.
Expected results are shown in D7 and D22. Likewise, I need to get the values in all the yellow highlighted cells.
Thanks in advance.
The below linked excel file Module1, I have a below code to find out the Yellow highlighted cells without any values in that,
After finding those cells I need to check each highlighted cells intersect column "A" Value (Date) and then it has to check those dates in another sheet then respective RM2 to RM52 has to sum up the values in the highlighted cells.
Expected results are shown in D7 and D22. Likewise, I need to get the values in all the yellow highlighted cells.
Dropbox - File Deleted - Simplify your life
www.dropbox.com
Thanks in advance.
Code:
Option Explicit
Sub SelectColoredCells()
Dim rCell As Range, PDate As Range
Dim lColor As Long
Dim rColored As Range
Dim High As Date
lColor = RGB(255, 255, 0)
Set rColored = Nothing
For Each rCell In Sheet6.Range("D1:CY300")
If rCell.Interior.Color = lColor And rCell.Value = "" Then
If rColored Is Nothing Then
Set rColored = rCell
Else
Set rColored = Union(rColored, rCell)
End If
End If
Next
If rColored Is Nothing Then
MsgBox "No cells match the color"
Else
rColored.Select
End If
End Sub