excel - VBA Rename Folder Code -


i've been working on code rename thousands of folders within parent folder. here have far -- i'm not entirely sure put or codes use.

i have excel file set column b old file source , column c new file source.

how code vba?

sub folderrename() 'declaring variables dim complete_pathof_folder string, state string = 2 sheets("rename file").range("b2").end(x1down).row 'variable values complete_pathof_folder = cells(i, 2) state = cells(i, 5)  'renames original folder name name "c:\users\n0269632\desktop\customers\afl telecommunications"   "c:\users\n0269632\desktop\customers\afl telecommunications (sc)" next  'repeats code until empty cell reached until isempty(cells(irow, 1)) dcellvalues(irow) = cells(irow, 2).value irow = irow + 1 loop end sub 

you've put original folder name variable (complete_pathof_folder), put new folder name variable same way:

newfolderpath = cells(i,3).   

then want use these variables in name statement:

 name complete_pathof_folder newfolderpath 

you want error checking such as:

  if dir(complete_pathof_folder) <> ""            name.....   end if 

otherwise, code throw error if path in list doesn't exist.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -