Attached Code should find the column on the MASTER sheet dated today (Col T) and fill each cell where the file number in Col D matches a file in Col D of the TODAY sheet.
It's picking up the correct row, but then identifies "today" as Column U (tomorrow's date), but then "filling" Column X, which is Thursday!
Option Explicit
Dim a As Long, f As Long, x As Long, y As Long
Dim FindString As String
Dim Rng As Range, Rng2 As Range
Sub MATCHUP()
With Sheet2
f = .Cells(.Rows.Count, "D").End(xlUp).Row
For a = 2 To f
FindString = .Range("D" & a)
If Trim(FindString) <> "" Then
With Sheets("MASTER").Range("D:D") 'searches all of column D
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
x = Rng.Row
y = WorksheetFunction.Match(CLng(CDate(Now)), Range("2:2"), 0)
.Cells(x, y).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent4
.TintAndShade = 0.599993896298105
.PatternTintAndShade = 0
End With
End If
End With
End If
Next
End With
End Sub
No idea why, so all suggestions, recommendations and alternatives welcome as ever.
Ochimus
Bookmarks