Niraj Baraili
Member
Hi Experts,
Need on this.....
I have a recorded macro as below:
My file name is - "Data Consolidation - May 2016.xlsx". Every month i have to change the file name to "Data Consolidation - June 2016.xlsx", "Data Consolidation - May 2016.xlsx".
Is there a way instead of going to module changing the code, my code runs.
Need on this.....
I have a recorded macro as below:
Code:
Dim Wb As Workbook
Dim wb1 As Workbook
fname = "Data Consolidation" & Sheet1.Range("G1")
Path = "C:\Users\niraj.baraili\Desktop\Automation\"
Set Wb = Workbooks.Open(Path & fname)
Set wb1 = ThisWorkbook
wb1.Activate
Sheet1.Select
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(indirect([" & Sheet1.Range("D2") & "]Qtr1'!C5),indirect([" & Sheet1.Range("D2") & "]Qtr1'!C2),RC[-1])"
My file name is - "Data Consolidation - May 2016.xlsx". Every month i have to change the file name to "Data Consolidation - June 2016.xlsx", "Data Consolidation - May 2016.xlsx".
Is there a way instead of going to module changing the code, my code runs.