Rename files in bulk using macro | Excel VBA

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024
  • Telegram (for Live events, Quick Questions): t.me/letsautomate
    Download File : github.com/kam...
    Renaming files in bulk is easy using vba. In this tutorial, you'll learn how to rename thousands of files (may be of a specific extension) in one go.
    There are two sub procedures explained in this example. One fetches names of all files in a folder and the other one helps in renaming them.
    Watch this tutorial and do not forget to hit like and subscribe to our channel.
    We are looking forward for your comments. :-)

Комментарии • 191

  • @BlakJak206
    @BlakJak206 4 года назад +1

    I've been trying to figure out how to do exactly this literally all day! So many websites and videos made it seem so complicated and used so many more lines of code, and yet what you did is so simple and took hardly any time to do! Thank you so much!
    P.S. I know absolutely nothing about VBA and was able to get this working in about 10 minutes or so. Don't know how this works, but it gets the job done so can't complain.

  • @kathleenmontiel2056
    @kathleenmontiel2056 4 года назад +7

    I can't believe someone would share such a valuable tool. I am super grateful for this. You are amazing. Thank you very much!

    • @xtremeExcel
      @xtremeExcel  4 года назад

      Glad it was helpful! Stay connected! :-)

  • @KamarudheenCk
    @KamarudheenCk 4 года назад +2

    This is unbelievable, man, you saved my life. it's so simple to use, download the .xlsm file, choose folder path. assign the names to be renamed, press button finish, The magic happens. :)

    • @xtremeExcel
      @xtremeExcel  4 года назад +2

      Thank you dear. Stay connected😃😃

  • @scottnantell6029
    @scottnantell6029 5 лет назад +17

    First macro runs fine. The 2nd didn't work and kept generating a run-time error.

  • @ve6571
    @ve6571 Год назад

    It's just amazing. I spent 3 hrs on some complicated codes. And finally this helped me quickly. Thank you so much.

  • @cheungcassie3047
    @cheungcassie3047 4 года назад

    I cant believe how come you can be so kind to save the world's time!! Thanks so much mate!!!

  • @susmithasunil6611
    @susmithasunil6611 3 года назад +2

    You are a saviour❤️ Thank you so muchhhhhhhh.. So easy to follow and completed task with out any error. 😍

  • @SaSeshen
    @SaSeshen Год назад

    This is literally game changing code for me... I had over 1,000 files I needed to convert to a different naming system and I thought I was going to die if I had to do it manually... now I just press 3 buttons... Christ this is a miracle!!!

  • @martianboy9886
    @martianboy9886 7 лет назад +2

    This is absolutely amazing. I'm new to coding, but I am motivated to learn due to my new job. Thank you for the help!

    • @xtremeExcel
      @xtremeExcel  7 лет назад

      Thank you for the feedback. Keep supporting.. :-)

  • @techiesahamad5979
    @techiesahamad5979 2 года назад

    Very much useful tutorial for novice users. It served my purpose easily. Thank you Kamal.

  • @Destine77
    @Destine77 5 лет назад

    Thank you so very much! This is a task that I complete monthly. You have reduced the time in accomplishing this task substantially.

  • @techfununlimited6579
    @techfununlimited6579 8 месяцев назад

    Did what exactly i was looking for... Thanks a lot... Earn a subscriber...

  • @djmontoro
    @djmontoro 7 лет назад

    Thanks, this is very useful for my job. I always need to rename a lot files in a given order one by one, but now I will use a custom order list in excel and them run this code. It will save me a lot of time.

  • @javierdavila24
    @javierdavila24 3 года назад +1

    Everything runs very well. Thank you for share with us

  • @namanbasantani
    @namanbasantani 4 года назад +2

    Superb man.. you are too good. Thanks yaar brother..

  • @ranajsingh
    @ranajsingh 4 года назад +1

    absolutely simple and clear piece of code..! great job.! kudos for this knowledge sharing..!

    • @xtremeExcel
      @xtremeExcel  4 года назад

      Thank you for the feedback.. Stay connected! :-)

  • @maksim0933
    @maksim0933 Год назад

    Very clear video and explanation and code, I subscribed 👍

  • @keuanganinsa1006
    @keuanganinsa1006 2 года назад

    Excellent ...thanks a lot for u ...from Indonesia

  • @nikitakaushal6382
    @nikitakaushal6382 2 года назад

    Thanksyou so much for help... Really appreciate ur support on call.

  • @Jeff_Gaudette
    @Jeff_Gaudette 3 года назад +1

    I sub'ed.
    Great tool & very gracious of you to share the code!

  • @user-ce2jb8nu4l
    @user-ce2jb8nu4l 6 месяцев назад

    Thanks Kamal!! This will save me a lot of time!!

  • @aswathkn1719
    @aswathkn1719 5 лет назад +4

    This is life savior. Thanks a lot for this tool

  • @dandanakan0
    @dandanakan0 4 года назад

    dear Kamal, thank you very much, and much appreciated it.
    all the best

  • @tongirri
    @tongirri 4 года назад +1

    Thank you very much. It saved my time for renaming a lot of files.

  • @laraszepesi5928
    @laraszepesi5928 2 года назад

    Many thanks, I have been looking for an easy solution. :)

  • @uzaktansertifika8168
    @uzaktansertifika8168 4 года назад

    Dear Kamal, thank you so much for your helpful video.

  • @stamatarsenikos9708
    @stamatarsenikos9708 3 года назад +1

    excellent solution. great coding.

  • @tajammulhussainKhadir
    @tajammulhussainKhadir 5 лет назад +1

    Highly appreciated kamal
    Many thanks for your kindness

    • @xtremeExcel
      @xtremeExcel  5 лет назад +1

      Thank you for such a nice comment Tajammul! This really keeps me motivated to post such tutorials for community.

  • @jomercasugay1406
    @jomercasugay1406 2 года назад

    thank you for sharing!! truly amazing.. wish you success sir!

  • @bayu2861
    @bayu2861 3 месяца назад

    great videos , just a question if i want to rename the file and copy to another path ? the old file list in different sub folder

  • @nimeshfaria1242
    @nimeshfaria1242 4 года назад +1

    Thanks Kamal. Amazing and time efficient

    • @xtremeExcel
      @xtremeExcel  4 года назад

      Thank you Nimesh. Stay connected:-)

  • @Kiran994.
    @Kiran994. 3 года назад +1

    It's really useful bro thanks🌹🌹🌹.

  • @simplereef4854
    @simplereef4854 Год назад +1

    This macro has a major flaw. If the file is not English characters then the macro will fails. I have to write one additional subroutine to get around that problem.

    • @xtremeExcel
      @xtremeExcel  Год назад

      great. please post your updated code that others can also use.

  • @ManojSingh-sb2ph
    @ManojSingh-sb2ph 5 лет назад +1

    Thanks lot sir it really very helpful for me thanks awsome 😊😃

    • @xtremeExcel
      @xtremeExcel  5 лет назад

      Thank you Manoj.. Please subscribe and share with your friends and help my mission to teach a million students.. :-)

  • @PremSingh-ry7ek
    @PremSingh-ry7ek 4 года назад

    Great way of teaching

  • @roadlizard2651
    @roadlizard2651 2 года назад

    Thank you sir! You just made my night!

  • @latoyaj.harris620
    @latoyaj.harris620 6 лет назад

    LOVE!!!!!! You made this sooooo simple! Thank you! Thank you!!!

  • @chillalamol
    @chillalamol 5 лет назад +1

    Hey Thanks Boss, it help's me in my daily routine work. Thanks a a lot !

    • @xtremeExcel
      @xtremeExcel  5 лет назад

      @Amol. that's awesome.. stay connected..

  • @prashantchauhan449
    @prashantchauhan449 4 года назад +1

    Hi Kamal, Thanks for sharing such valuable knowledge, i also updated the code as you taught, but unable to get the folder path in the bar, like as you have shared a template file , Please advise

    • @xtremeExcel
      @xtremeExcel  4 года назад

      Can you share your code/files with me so that I can debug?

  • @mxrvxn08
    @mxrvxn08 2 года назад +1

    it works! thank you.

  • @BharatPatel-vb5xc
    @BharatPatel-vb5xc 7 месяцев назад

    How if in case there are xls files if we can change the sheet name as well at the same time

  • @medasbabu
    @medasbabu 3 года назад

    Thanks will be using your code, just need to modify it so that it can rename files in the subfolder also.

    • @MsTeebree
      @MsTeebree 3 года назад

      Did you come up with the fix so it could reach the subfolders also?

  • @keithmctaggart7663
    @keithmctaggart7663 5 лет назад +2

    can you add some code to include all files in subfolders of the folder chosen to rename please

  • @rochellejennings5280
    @rochellejennings5280 6 лет назад +2

    Great video thank you. Can this also be used to change folder names too?

    • @xtremeExcel
      @xtremeExcel  6 лет назад

      sure. .I'll post a tutorial on this subject soon.

  • @cookieaddictions
    @cookieaddictions 2 года назад

    I successfully did this before but now when I try to run the first part to fetch the names nothing happens. It just brings up a list of macros and ask me if I want ti run it and when I select run nothing happens. I’m not sure what I’m doing wrong, I did exactly what you did in the video.

  • @debjani_d
    @debjani_d 3 месяца назад

    Why is it showing an error - run time error '53': File not found?

  • @dipakjangam6018
    @dipakjangam6018 4 года назад +1

    Veer good video i leran new thing

  • @mathconcept8635
    @mathconcept8635 3 года назад

    Hi, we would follow up if the old file is Chinese font and show '?' & how can fix this?

  • @EliasDaoud
    @EliasDaoud 5 лет назад

    Please can you try file names with space in your program in this video? does this work? example "C:\test\360_00 67.jpg" space included

  • @jaikishen100
    @jaikishen100 4 года назад +1

    Suberb man keep it up..Thank u so much

  • @user-ws7mn5nw3e
    @user-ws7mn5nw3e 2 года назад

    can u tell me pls which version is applicable of MS office? I use office 2007.here it is n't work.pls help & reply.

  • @satijamanoj
    @satijamanoj 4 года назад +1

    Awesome video. its a huge help

    • @xtremeExcel
      @xtremeExcel  4 года назад

      Thanks Manoj. Stay connected

  • @mohammedkabiri6485
    @mohammedkabiri6485 4 года назад +1

    Hi Kamal, is there a way to possibly modify the macro, so instead of showing only the files names inside the folder, it will show the name of files in the subfolders as well, so when we click on "Get Files Names' it displays all the files names? Thank you very much :)

  • @kathyhoey4745
    @kathyhoey4745 5 лет назад

    Thank you very much. Worked like a charm!

  • @jugal8591
    @jugal8591 3 года назад

    Invaild Qualifier Error for IsEmpty is Coming. How can I Fix it ?

  • @felixwijaya868
    @felixwijaya868 7 лет назад +1

    Hi sir, is that possible to sort it as date modified when you fetch the name? thanks

  • @SmaraVic
    @SmaraVic 9 месяцев назад

    Hello. I hawe an issue. I receive an error when I try to renamd files that contain ș ț î ă â and. Di you hawe a solution for this?

  • @deepanatarajan5323
    @deepanatarajan5323 4 года назад +1

    Super one !! thank you loads

  • @ifrazimanudeen4462
    @ifrazimanudeen4462 6 лет назад +1

    That’s a very useful and simple way of doing.
    Can this done for the sheet of Excel files in a folder.
    Say like there are 60 Excel Files with single sheet in each of them in same folder and I want to rename the sheet of every excel file.
    Please make a video for above request
    Thanks

    • @xtremeExcel
      @xtremeExcel  6 лет назад

      Thank you Ifraz. I'll plan for a video on this soon. However if you need this urgently, feel free to write to me at excel.microk@gmail.com

  • @MsTeebree
    @MsTeebree 3 года назад

    Is there a VBA code that can search multiple folders and rename all of the files in the different folders? In column A I have the filepath down to the pdf that I want renamed and in Colum B I have what I want to change the name to.

  • @murugantgi
    @murugantgi 3 года назад

    Thanks for the video. The 2nd coding is not working. It’s shows Run-time error ‘5’; . Invalid procedure call or argument. Any thoughts why it’s not working?

  • @user-up3dd1vw6b
    @user-up3dd1vw6b 5 лет назад +1

    macro may not be available on this workbook or all macros may be disabled

    • @aswathkn1719
      @aswathkn1719 5 лет назад

      Right click on get file names. Select macros. Fetch files..edit. and change the location

  • @822sanjeev
    @822sanjeev 6 лет назад

    Required macro to split the PDF file in to multiple files with different ranges of pages

  • @haroldlopez8900
    @haroldlopez8900 2 года назад

    Legend!
    It helped me a lot! Thank you!

  • @bsanju585
    @bsanju585 4 года назад

    Brother tell us how did you create that 3 bottons please

  • @moas3060
    @moas3060 5 лет назад +1

    Hi, it is very useful. But unfortunately, it copies file extension with it. Is there any way that the file extensions should not be copied.

    • @xtremeExcel
      @xtremeExcel  5 лет назад

      Yes.. we can do it.. please attach your file (with code )to my email id and I'll send you the updated code..

  • @vernettep
    @vernettep 7 лет назад +3

    Thank you for this, however I cannot get it to work. I edited the macro so it points to a folder path where my files are stored and thought that would be all I needed to do, however it isn't working.

    • @xtremeExcel
      @xtremeExcel  7 лет назад

      Please share your file at excel.microk@gmail.com and I'll look into it..

    • @djmontoro
      @djmontoro 7 лет назад +1

      First time I run it didn't work, then I realized that when I copied the folder path from the window and paste it in the VB, it didn't show the last back slash "\". It need to have that last back slash in order to work.

    • @jasonkoth4761
      @jasonkoth4761 5 лет назад

      @@djmontoro Thank you this was my issue as well! Works great now

  • @shadabsirkhot2323
    @shadabsirkhot2323 Год назад +1

    Thanks a lot.

  • @pawelpala4050
    @pawelpala4050 4 года назад +1

    Thank you for sharing.

  • @md-mohammed8455
    @md-mohammed8455 Год назад

    Sir , please share with some update in code., That is , no need extension name in file name, need only file name.
    Hope you understand sir
    Thanks,

  • @momowongmh3297
    @momowongmh3297 4 года назад

    Hi can you make another version so that it can get all filenames inside a a big foldet which include subfolder? Thanks a lot

  • @grumpyfan777
    @grumpyfan777 4 года назад +1

    I use this to rename mp3 files when I rip some of my audiobooks. Windows media player can't find the names so I have to rename them. I was able to reformat the names how I wanted but I couldn't get it to add the .mp3 at the end so I had to add it manually. Am I doing something wrong?

    • @xtremeExcel
      @xtremeExcel  4 года назад

      It is hard to understand what exactly you have done and what has happened. Can you record a small video of what steps you have performed so that I can see?

  • @fairyzhang8513
    @fairyzhang8513 3 года назад

    Hello, your Excel VBA renamed all my document name at once, but the document version is not a PDF file anymore, could you please help me further, many thanks.

    • @xtremeExcel
      @xtremeExcel  3 года назад

      Did you put extension in the output file names?

  • @ujjawalso
    @ujjawalso 4 года назад

    Can we create multiple folders with desired excel document inside all folder in bulk?

  • @Bharani_0601
    @Bharani_0601 6 лет назад

    Hi Bro, you are fetching details into column A and B. Can we assign the same to some other column like D, E F ?

  • @EliasDaoud
    @EliasDaoud 5 лет назад

    Moreover, to my previous comment and after using Name statement. I can say it is unstuck, failing or good-for-nothing. Unpredictable errors or fail to rename files (sure they are not opened, not readonly)

    • @xtremeExcel
      @xtremeExcel  5 лет назад

      Relax Elias. I am sure you must be doing something wrong. Share your code with me.

    • @EliasDaoud
      @EliasDaoud 5 лет назад

      @@xtremeExcel I am sure,
      can you tell me why one of the following lines work where the other not ? I am programmer (~33 years) for many Languages. and mainly Mech Eng. so I can understand you fast. (.JPG & .jpg work both)
      Name "D:\Test\660_000010.JPG" As "D:\Test\760_0009.JPG" work
      Name "D:\Test\660_000010.JPG" As "D:\Test\660_0009.JPG" doesn't work
      This is one of many
      Name "D:\Test\660_0008.JPG" As "D:\Test\660_0001.JPG" work
      Name "D:\Test\660_0000.JPG" As "D:\Test\660_0001.JPG" doesn't work

  • @srinuvenkat78
    @srinuvenkat78 4 года назад

    Hi
    Could you do the video including buttons portion also and fetching names code is perfectly working but renaming code is not functioning and saying run time error.....

  • @shubhamgupta9505
    @shubhamgupta9505 5 месяцев назад

    I don't know my code is not working. Please help me out

  • @jacobjacqueline823
    @jacobjacqueline823 6 лет назад +1

    Hi I am trying to modify my file but unable to keep the format of the image.can you tell me how to keep the same format?

    • @xtremeExcel
      @xtremeExcel  6 лет назад

      please send me your file. excel.microk@gmail.com

  • @binoyjohn6676
    @binoyjohn6676 4 года назад

    @Extreme Automation - Kamal Girdher Thanks A lot for such a great video, Its appreciable if u can share Codes for picking Folder path from a specific cell (In my Case "Sheet1"("O5")) in same workbook instead of pre-defined folder path, I tried to get a code for the same from internet, but i cound not make it. Thanks in advance for your support

  • @nonenone2858
    @nonenone2858 6 лет назад

    Hi, it possible to have a word file that was just created take some data(names and values) from inside it and automatically introduce those values in the title of the file? When I close the new document at exit to have the file renamed in my folder automatically by taking the data of choice from inside it?

  • @vuchinavook1770
    @vuchinavook1770 3 года назад +1

    This is great. THX

  • @huynguyen7572
    @huynguyen7572 3 года назад +1

    Great, thanks. I'm getting debug on Name myPath & Cells(r, 1).Value As myPath & Cells(r, 2).Value

    • @xtremeExcel
      @xtremeExcel  3 года назад

      Thanks! Please share you file and screenshot of the error

    • @huynguyen7572
      @huynguyen7572 3 года назад

      @@xtremeExcel
      This is the error: "Name myPath & Cells(r, 1).Value As myPath & Cells(r, 2).Value ". I don't know how to get the screenshot to send to you.

  • @ahrorkuldashev9603
    @ahrorkuldashev9603 4 года назад +1

    Hi, thank you for the video! I was wondering if it would be possible to use folder picker with this video rather than hard coding the file path. Would appreciate if you have such code.

    • @xtremeExcel
      @xtremeExcel  4 года назад

      Yes it is possible as well as recommended way.

    • @binoyjohn6676
      @binoyjohn6676 4 года назад

      ​@@xtremeExcel Thanks A lot for such a great video, Its appreciable if u can share Codes for picking Folder path from a specific cell in same workbook instead of pre-defined folder path, I tried to get a code for the same from internet, but i cound not make it. Thanks in advance for your support

  • @ulhas610
    @ulhas610 4 года назад

    Hi,
    Using this simple code still useful in 2020. This works great, but now I'm trying for same name and I get this message:

    "Run-time error '58':
    File already exists"
    Debugging highlights this line "Name myPath & Cells(r, 1).Value As myPath & Cells(r, 2).Value"
    Any tips? if file name already exists then replace without asking or any msgbox
    .
    You help much more appreciate.

  • @vishalkumar-vt3xi
    @vishalkumar-vt3xi 4 года назад

    You are not defining the variable r here, i think it would be a good practice to define all ur variables. Or do you think it is really not necessary to define variable r??

  • @aijadzerox
    @aijadzerox Год назад +1

    tq Sir.

  • @MegaRockstar90210
    @MegaRockstar90210 4 года назад +1

    Thank you so much for this!! This is a wonderful tool. I tried and it worked, however it is converting my PDF to file. How do I keep the .pdf? Thank you!

    • @xtremeExcel
      @xtremeExcel  4 года назад

      Can you share some more details of your input and outout. :-)

    • @MegaRockstar90210
      @MegaRockstar90210 4 года назад

      @@xtremeExcel I am trying to change names of multiple PDF files. When I use the template and change the name, it converts it from .pdf to type: file. When I try to open the file it makes me select the output. I am able to then open it in PDF if I select "Open with Adobe". Is there a way to keep it in .pdf type after changing the name? I hope this makes sense.

    • @janetfrias3687
      @janetfrias3687 4 года назад

      @@MegaRockstar90210 It worked for me by just adding .pdf to the end of the file name.

  • @aristotleashok8990
    @aristotleashok8990 4 года назад

    Hi dood, my files corrupting once macro done it's work... Gimme solution plz...

  • @stephenlefranc3805
    @stephenlefranc3805 4 года назад

    Does this work for Mac I can't get the file names thing to open...

  • @linsuportable
    @linsuportable 5 лет назад

    Hello to all, I have 4000 files in .doc to convert into .docm. I thaught that the macro as shown in the video would have helped. Unfortunately this message is poping up "cannot run the macro. The macro may not be available in this workbook or all macros may be disabled"
    I have enabled all macros, still the same issue. Does anyone have a solution? Thank in advance

  • @suganthi1418
    @suganthi1418 4 года назад +1

    Thank you very much....

  • @ProviderKnowledge
    @ProviderKnowledge 2 года назад

    thanks

  • @ambikathakur7384
    @ambikathakur7384 Год назад

    This isn't working for me
    I get an error

  • @suganthi1418
    @suganthi1418 4 года назад

    Can you add a video or include code for extraction of files from zipped folder? Thank you

  • @kainaaguiarferreira4351
    @kainaaguiarferreira4351 3 года назад

    Thanks Man!

  • @raghavshanbhag9308
    @raghavshanbhag9308 7 лет назад

    appricate your grat knowladge

  • @beehroidahmadi4352
    @beehroidahmadi4352 2 года назад

    Thanks my boro

  • @dikshantginwal4085
    @dikshantginwal4085 5 лет назад +1

    Thanks bro it worked

  • @iivansi3
    @iivansi3 5 лет назад

    man your code rulz. thank you very much sir :)