VBA for paste data at specific date row

ainnn88

New Member
Joined
Dec 22, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
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
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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.
 
Upvote 0

Forum statistics

Threads
1,224,621
Messages
6,179,929
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top