Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Renaming files in a directory

In a spreadsheet called FileList I have a list of files in Col A like this:

C:\Documents and Settings\##My Documents\My Things\Blah Blah
Blah\Folder_2\01 Filename

In Col B I have the new file names like this:

C:\Documents and Settings\##My Documents\My Things\Blah Blah
Blah\Folder_2\01 New Filename

I want to replace all the file names in Col A with the new file names in Col
B so the file name in A2 would be replaced by B2 etc.

How do I make my macro Name OldFileName as NewFileName through each row in
the 2 lists?

Any help would be much appreciated

Many thanks

Kewa



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Renaming files in a directory

Hi Kewa

The basic code looks like this
Maybe it is better to test if the file in A exist before you rename it ?


For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
Name cell.Value As cell.Offset(0,1).Value
Next cell



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"nospaminlich" wrote in message ...
In a spreadsheet called FileList I have a list of files in Col A like this:

C:\Documents and Settings\##My Documents\My Things\Blah Blah
Blah\Folder_2\01 Filename

In Col B I have the new file names like this:

C:\Documents and Settings\##My Documents\My Things\Blah Blah
Blah\Folder_2\01 New Filename

I want to replace all the file names in Col A with the new file names in Col
B so the file name in A2 would be replaced by B2 etc.

How do I make my macro Name OldFileName as NewFileName through each row in
the 2 lists?

Any help would be much appreciated

Many thanks

Kewa



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Renaming files in a directory

Many thanks Ron. That works a treat.

Kewa
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming files in a directory Candyman Excel Programming 2 December 7th 05 07:16 PM
Maintain cell links when renaming directory containing multiple f Excel52 Excel Worksheet Functions 0 April 28th 05 10:54 PM
Renaming adding and deleting directory alanford Excel Programming 2 February 16th 05 11:08 AM
Renaming all files in a directory Jan Kronsell[_3_] Excel Programming 4 February 19th 04 12:33 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 02:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"