Link to home
Start Free TrialLog in
Avatar of kbay808
kbay808Flag for United States of America

asked on

VBA - How to copy range and paste the values to the right of todays date in another range?

In the attached example, I need to copy range B2:E2 and then paste the values to the right of todays date that is located in column G.
Example-File.xlsx
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kbay808

ASKER

It works, but I need it to only paste the values.  In my working copy the source data cells have formulas.
Avatar of kbay808

ASKER

I got it.  It was an easier fix than I thought.
Sub MoveToToday()
Dim Res As Variant
    
    Res = Application.Match(CLng(Date) - 1, Sheets("Sheet1").Range("G:G"), 0)
    
    If Not IsError(Res) Then
        Range("B2:E2").Copy
        Range("H" & Res).PasteSpecial xlPasteValues
    End If
    
End Sub

Open in new window

Avatar of kbay808

ASKER

Thank you very much