using excel to change filenames

S

spence

i have several hundred files on my HD for a certain
program i use and i would like to change all of their
filenames, is it possible to import them into a
spreadsheet, manipulate the file names with some formulas
ans use the manipulated names to rename the files?
 
A

Andy B

spence

It's fairly easy to do it in DOS, but it would mean doing it one directory
at a time. Is that any use?

Andy.
 
M

Myrna Larson

You could do this with a VBA macro. Assuming your data starts in row 1, with the path in column
A, the old name in B, and your new name in C:

Option Explicit

Sub RenameFiles()
Dim R As Long
Dim S As String
Dim TheData As Variant

S = Application.PathSeparator
TheData = Range("A1").CurrentRegion.Resize(ColumnSize:=3).Value

For R = 1 To UBound(TheData, 1)
Name TheData(R, 1) & S & TheData(R, 2) As _
TheData(R, 1) & S & TheData(R, 3)
Next R
End Sub
 
S

spence

that would be fine can you tell me how
-----Original Message-----
spence

It's fairly easy to do it in DOS, but it would mean doing it one directory
at a time. Is that any use?

Andy.



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top