Option Explicit
Sub example()
Dim rFind As Range, _
MatchDate As Date, _
ms As Worksheet, _
ws As Worksheet, _
rng As Range, _
Cel As Range
Dim TestCol As Range
Dim FirstDCFCol As String
Dim LastDCFCol As String
Application.ScreenUpdating = 0
Set ms = Sheets("DCF Equity")
With Sheets("DCF Equity")
'--------------------------------------------
' option #1: hard coded range
For Each TestCol In .Range("F14:H14")
'------------------ OR ---------------------
'option #2: dynamic last column
FirstDCFCol = "F14"
LastDCFCol = .Cells(14, Columns.Count).End(xlToLeft).Address
For Each TestCol In .Range(FirstDCFCol, LastDCFCol)
'---------------------------------------------
MatchDate = TestCol.Value
With Sheets("Data Check")
Set rFind = .Rows(1).Find(MatchDate, LookIn:=xlValues, LookAt:=xlWhole)
If Not rFind Is Nothing Then
For Each Cel In ms.Range("B16", ms.Range("B" & Rows.Count).End(xlUp))
Set rng = .Columns(2).Find(Cel, LookIn:=xlValues, LookAt:=xlWhole)
If Not rng Is Nothing Then
ms.Range("F" & Cel.Row) = .Cells(rng.Row, rFind.Column)
End If
Next Cel
End If
End With 'data ck
Next TestCol
End With 'dcf eq
Set ms = Nothing
Set ws = Nothing
Set rFind = Nothing
Set rng = Nothing
Application.ScreenUpdating = True
Application.ScreenUpdating = 0
End Sub
Bookmarks