I have the following code that matches the date between two worksheets and copies and pastes the data for a specific column. In the one below it copies and paste for F14. I would like to loop through the columns such as F14 then G14 then H14 etc. How can I go about doing that?
Dim rFind As Range, MatchDate As Date, ms As Worksheet, ws As Worksheet, rng As Range, cel
Application.ScreenUpdating = 0
Set ms = Sheets("DCF Equity")
MatchDate = Sheets("DCF Equity").Range("F14")
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
End If
End With
Set ms = Nothing
Set ws = Nothing
Set rFind = Nothing
Set rng = Nothing
Application.ScreenUpdating = True
Application.ScreenUpdating = 0
Bookmarks