D Deepak Sharma Member Jan 15, 2018 #1 Hi All, I need to rename around 100 files. Just need to add "2016" after the actual file names. I have done some coding but throwing some error in Save As line. Please see the attached file. Thanks and Regards, Deepak Sharma Attachments Rename files with VBA.xlsm 12.1 KB · Views: 3
Hi All, I need to rename around 100 files. Just need to add "2016" after the actual file names. I have done some coding but throwing some error in Save As line. Please see the attached file. Thanks and Regards, Deepak Sharma
shrivallabha Excel Ninja Jan 15, 2018 #2 Are the original files also having extension csv? Are all the files in this folder of same type?
D Deepak Sharma Member Jan 16, 2018 #3 Hi shrivallabha, Yes every file is .csv Old File Name is = uk_export_Week49.csv should be replaced by New File Name = uk_export_Week49_2016.csv Thanks !!!
Hi shrivallabha, Yes every file is .csv Old File Name is = uk_export_Week49.csv should be replaced by New File Name = uk_export_Week49_2016.csv Thanks !!!
D Deepak Sharma Member Jan 16, 2018 #4 HI, I have again try to rename the file name but it's taking file name with extension also & it's saving like this :- old file name is uk_export_Week23 After running vba code it's saving like :- uk_export_Week23.csv_2016 this .csv should not come here. file name should be like :- uk_export_Week23_2016 Please advice ! File attached Thanks and Regards, Deepak Sharma Attachments Rename files.xlsm 16 KB · Views: 7
HI, I have again try to rename the file name but it's taking file name with extension also & it's saving like this :- old file name is uk_export_Week23 After running vba code it's saving like :- uk_export_Week23.csv_2016 this .csv should not come here. file name should be like :- uk_export_Week23_2016 Please advice ! File attached Thanks and Regards, Deepak Sharma
Marc L Excel Ninja Jan 16, 2018 #5 Hi ! Code: Sub Demo4Noob() MsgBox Replace("uk_export_Week23.csv", ".csv", "_2016.csv") End Sub Do you like it ? So thanks to click on bottom right Like !
Hi ! Code: Sub Demo4Noob() MsgBox Replace("uk_export_Week23.csv", ".csv", "_2016.csv") End Sub Do you like it ? So thanks to click on bottom right Like !
D Deepak Sharma Member Jan 16, 2018 #6 Hi Marc, This won't sort out the issue actually. File names are different. there are 100 files. Regards, Deepak Sharma
Hi Marc, This won't sort out the issue actually. File names are different. there are 100 files. Regards, Deepak Sharma
Marc L Excel Ninja Jan 16, 2018 #7 It's just a sample to show you how to ! See Replace function in VBA inner help, at beginner level, even a child … Deepak Sharma said: I have done some coding Click to expand... With my sample and after reading help, you will be able to mod your code ! As coding is like fishing, I won't bring you a fish everyday but I show you how to fish …
It's just a sample to show you how to ! See Replace function in VBA inner help, at beginner level, even a child … Deepak Sharma said: I have done some coding Click to expand... With my sample and after reading help, you will be able to mod your code ! As coding is like fishing, I won't bring you a fish everyday but I show you how to fish …
Chihiro Excel Ninja Jan 16, 2018 #8 Also, no need to open files. You can just rename them. Ex. Code: For Each fil In fol.Files Name fil.path As Replace(fil.path, ".", "_2016.") Next fil
Also, no need to open files. You can just rename them. Ex. Code: For Each fil In fol.Files Name fil.path As Replace(fil.path, ".", "_2016.") Next fil
Marc L Excel Ninja Jan 16, 2018 #9 Be careful Chihiro if a file name contains several dots, unusual but possible …
D Deepak Sharma Member Jan 17, 2018 #11 Thanks alot Chihiro, It worked perfectly ! Thank you Marc ! Regards, Deepak