Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
vmorgan
 
Posts: n/a
Default using excel to rename filenames?

Is it possible to rename a group of filenames using Excel 2000? I have
a column of current filenames and an adjacent column of the desired new
filenames. All files to be changed are in the same folder as the Excel
file.
Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default using excel to rename filenames?

This worked for me--but test it against a folder with not much in it--just in
case:

Option Explicit
Sub testme()

Dim myPath As String
Dim myCell As Range
Dim myRng As Range

myPath = ThisWorkbook.Path & "\"

With ActiveSheet
For Each myCell In .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
On Error Resume Next
Name myPath & myCell.Value As myPath & myCell.Offset(0, 1).Value
If Err.Number = 0 Then
myCell.Offset(0, 2).Value = "Ok"
Else
myCell.Offset(0, 2).Value = "Failed to rename"
Err.Clear
End If
On Error GoTo 0
Next myCell
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

vmorgan wrote:

Is it possible to rename a group of filenames using Excel 2000? I have
a column of current filenames and an adjacent column of the desired new
filenames. All files to be changed are in the same folder as the Excel
file.
Thanks!


--

Dave Peterson
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
Open Excel 2003 from Windows Explorer pmpjr Excel Discussion (Misc queries) 9 September 11th 06 03:58 PM
Microsoft Excel in Microsoft works - how to open R J Gavin Excel Discussion (Misc queries) 3 September 16th 05 08:29 PM
In Excel, how do I rename the gray rows/columns (1,2,3/A,B,C)? rapunzel4040 Excel Discussion (Misc queries) 1 August 30th 05 10:35 PM
Stop Excel Rounding Dates leinad512 Excel Discussion (Misc queries) 1 April 20th 05 04:19 PM
I cannot rename my excel sheet? Cissy Excel Worksheet Functions 1 April 3rd 05 05:50 AM


All times are GMT +1. The time now is 05:11 PM.

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

About Us

"It's about Microsoft Excel"