Quantcast
Channel: Microsoft Community - Super Fresh
Viewing all articles
Browse latest Browse all 1237235

Find all days of four week in column with VBA

$
0
0

I have a column A and B with data. In the field A I have a numbers and B contain different days, I need to select all days in the field B are of the fourth week of the month and apply color to cells from column A and B. The below image is an example of that I need:

I try to create the below code but not work please help.

Sub Test()
    rng_RngColB = Range("B1:B1000").Row
    
    For i = 1 To rng_RngColB
        If Cells(i, 2).Value = Date + 20 Then
            Range("A2",Range("B2" & i)).Interior.Color = RGB(255, 255, 0)
        End If
Next i
End Sub



Viewing all articles
Browse latest Browse all 1237235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>