Amit Punia
Member
I need a VBA where I it updates the name of the excel file inside the excel file. There are 24 files in the folder. Path for this folder is D:\Amit\ and there are 12 files in it namely "Cash Report as on 11-05-2017 0000Hrs". We prepare these files daily after every 2 hours, so starting from midnight - 0000Hrs, 0200Hrs, 0400Hrs etc. Sometimes it does happen that we run the file after 3 hours making it 0500Hrs instead of 0400Hrs just after 0200Hrs. What I need is a VBA file which opens all these 12 files and in column A in the last row(just after the last row having any text, one cell below that need the file name which is opened. So if the VBA opened file "Cash Report as on 11-05-2017 0400Hrs" then in the last cell of the column A just after the text or data in the cell, using offset the very below blank cell should have the name of this file as "Cash Report as on 11-05-2017 0000Hrs". Likewise need something like this for all the files.
I was trying some of the codes but it's still in bits and pieces.
I was trying some of the codes but it's still in bits and pieces.
Code:
fldr = Activeworkbook.Path
Dt = Application.InputBox("Enter Date as 'dd-mm-yyyy' ", format(Now," dd-mm-yyyy"
Workbooks.open Filename:= fldr & "\Cash Report as on" & 0400 & "Hrs.xlsx"
Range("A1").End(xlDown).Select
Offset(1).Select