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! |
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 |
All times are GMT +1. The time now is 02:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com