# VBA for paste data at specific date row



## ainnn88 (Dec 23, 2022)

Hi,
my worksheet has monthly data from Jan-latest (dec 2022).
I need to paste new data at Dec 2022. ie; my last data is on 16th Dec and I want to replace 16th dec data with 23rd dec data.

What is the code that i should try?

now my code is: 

Sub FI_Val()

   'Open Valaution workbook
    Workbooks.Open Filename:= _
        "Valuation " & WorksheetFunction.Text(Sheet5.Range("DY1"), "yyyymmdd") & ".xls"
    File_name = Right(file_dir, 23)
    Range("A2:cc2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy

    Windows("Workbook" & ".xlsm").Activate
    Worksheets("Valuation").Activate

    'Find Date and Local Bond only
    Dim ExactDate As Date
    Dim sDate As String
    Dim EDate As Long
    ExactDate = Range("DY1").Value
    EDate = ExactDate
    Range("C:C").AutoFilter
    Range("C:C").AutoFilter Field:=1, Criteria1:=">=" & EDate
    Range("CP:CP").AutoFilter
    Range("CP:CP").AutoFilter Field:=1, Criteria1:="Local Bond"

I'am stuck which i need the macro to find the date and paste the data at that date


----------



## Joe4 (Dec 27, 2022)

Welcome to the Board!

I think it would be helpful if you could show us an example. 
What does your data look like to start?
Where is this new data coming from?
What should your ending result look like?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.


----------

