Hi Everyone
I've got a basic macro copying information from a specific workbook, and pasting in another
ExportFol = Report Directory of source workbook
YYYY_MM = the Year and month the Data is for e.g. "2014 02"
Report = Report Name e.g. "Report.XLSM"
' Open up Source Workbook
Workbooks.Open Filename:= ExportFol & YYYY_MM & " Source Workbook.XLS"
Sheets("Database").Activate
' Copy Data
Sheets("Database").Range("D2:D500").Select
Sheets("Database").Range("D2:D500").Copy
' Open Report
Windows(Report).Activate
Sheets("Sheet1").Activate
' Paste data
Sheets("Sheet1").Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
' Close Source Workbook
Workbooks.Open Filename:=ExportFol & YYYY_MM & " Source Workbook.XLS"
ActiveWorkbook.Close False
I want to paste in a very specific location, which will change depending on what month the report was run for
In Range("A2:A13") I have the related Reporting Period in the YYYY_MM format (2013 07, 2013 08, 2013 09, etc)
I was wondering if there was a way to Find a specific reporting month in the range (A2:A13) using my existing defined String YYYY_MM, then Offset(0,1) from it and paste next to it
So e.g.
If running the report for July 2013
- Cell A2 = 2013 07
- Offset(0,1) from A2, to get to B2, and paste there
If running the report for August 2013
- Cell A3 = 2013 08
- Offset(0,1) from A3, to get to B3, and paste there
Any Help be greatly Appreciated
Thanks in advance
Bookmarks