Hello Ravi -
I am interested in the macro you created. I have a similar task, where I need to name name images files. Where Column A will have the existing filename, and Column B will have the new file name.
I am looking at your macro and am wondering if I change the following lines if it will work (Sorry for my noob-ness I have never done anything with VBA before). I deleted two lines and changed the line in BOLD
So if I have a directory full of images:
1.jpg
2.jpg
3.jpg
4.jpg
and my excel as the following (note it may not contain everything in the dir):
| Column A | Column B |
1.jpg | aa1.jpg
3.jpg | cc3.jpg
4.jpg | dd4.jpg
Sub kaffal()
Dim z As Long, e As Long, g As Long
Dim f As String, b As String
Sheets("Sheet1").Select
Cells(1, 1) = "=cell(""filename"")"
Cells(1, 2) = "=left(A1,find(""["",A1)-1)"
Cells(2, 1).Select
f = Dir(Cells(1, 2) & "*.xls")
Do While Len(f) > 0
ActiveCell.Formula = f
ActiveCell.Offset(1, 0).Select
f = Dir()
Loop
z = Cells(Rows.Count, 1).End(xlUp).Row
For e = 2 To z
If Cells(e, 1) <> ActiveWorkbook.Name Then
b = Cells(1, 2)
Name Cells(1, 2) & Cells(e, 1) As b
Cells(e, 2) = b
End If
Next e
MsgBox "Renaming is complete."
End Sub
Bookmarks