Reputation: 27
Sorry my English not very good, also still newbie in macro.
I'm able to formula grabbing data doing copy paste other sheets on other files. but the problem is the files is on monthly and year.. So i need to change the macro formula every year.
Example:
Workbooks.Open Filename:= _
"C:\REPORT\2016\february\STOCK REPORT_JANUARI_*2016*.xls"
Is there any formula or something so i didn't need to change the year every times?
Upvotes: 1
Views: 61
Reputation: 33692
You can use the Year
Function.
Using Year(Date)
equals the year of the currebt date. For today, Year("28/02/2017")
equals 2017.
Replace your line of code with the line below:
Workbooks.Open Filename:= _
"C:\REPORT\2016\february\STOCK REPORT_JANUARI_*" & Year(Date) & "*.xls"
Upvotes: 3