fill cell color based on data

Tatu

New Member
Joined
Jun 18, 2020
Messages
6
how can i fill cell based on a intersection values from other sheet?

Based on sheet2 values, fill the yellow cells on sheet1.
 

Attachments

  • sheet1.PNG
    sheet1.PNG
    187.6 KB · Views: 9
  • sheet2.PNG
    sheet2.PNG
    198.3 KB · Views: 10

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I don't understand the logic as to why on Sheet1 there are 3 shaded areas when looking at Sheet2's dates.
 
Upvote 0
i'm trying to fill between startDate and Enddate.

Sub corresp()
Dim r As Integer
Dim c As Integer
Dim j As Integer
Dim k As Integer

For k = 4 To 10

For j = 4 To 366

If Not IsError(Application.Match(Folha2.Range("A" & k).Value, Range("A1:A8"), 0)) Then
r = WorksheetFunction.Match(Folha2.Range("A" & k).Value, Range("A1:A8"), 0)

End If

If Not IsError(Application.Match(Folha2.Cells(k, j), Range("A3:IU3"), 0)) Then

c = WorksheetFunction.Match(Folha2.Cells(k, j), Range("A3:IU3"), 0)

Cells(r, c).Interior.ColorIndex = 6

End If
Next j
Next k

End Sub

this code leave blank cell between date
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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