platoniciorf
New Member
- Joined
- Jul 10, 2015
- Messages
- 16
The worksheet where my data are coming from is named "Currency" sheet. This sheet automatically generates historical data/prices of currency rates (also equities) from Bloomberg daily upon entering the date range. Upon entering the date range, the most recent data/yesterday's closing price are then generated in the last row in each column. *Please understand that the most recent data in the five columns are sometimes not in the same rows.* I need all the most recent available data to be in the same row that's why I'm trying to paste it to another spreadsheet. Shown below are my existing VBA codes that copy and paste data in my "Currency" sheet to the same sheet in other cells. Please help me to instead of pasting the data in the same spreadsheet, I wish to paste all generated most recent available data to another sheet in the same row.Anyone who knows what do I need to change/add in my existing VBA codes please? Thanks! Sub Test() Dim ws As Worksheet Dim FinalRow As Long Set ws = ActiveWorkbook.Sheets("Currency") FinalRow = ws.Range("A" & ws.Rows.Count).End(xlUp).Row ws.Range("A" & FinalRow).Copy ws.Range("F2").PasteSpecial xlPasteValuesAndNumberFormats FinalRow = ws.Range("B" & ws.Rows.Count).End(xlUp).Row ws.Range("B" & FinalRow).Copy ws.Range("G2").PasteSpecial xlPasteValuesAndNumberFormats FinalRow = ws.Range("C" & ws.Rows.Count).End(xlUp).Row ws.Range("C" & FinalRow).Copy ws.Range("H2").PasteSpecial xlPasteValuesAndNumberFormats FinalRow = ws.Range("D" & ws.Rows.Count).End(xlUp).Row ws.Range("D" & FinalRow).Copy ws.Range("I2").PasteSpecial xlPasteValuesAndNumberFormats FinalRow = ws.Range("E" & ws.Rows.Count).End(xlUp).Row ws.Range("E" & FinalRow).Copy ws.Range("J2").PasteSpecial xlPasteValuesAndNumberFormats End Sub