I'm currently trying to write a VBA script for image processing purposes, to accurately change the title of an image file to contain all our required details. We currently have images created as a standard Reference IMG0001, IMG0002, onwards, which would be manually input into column A, and the idea is to fill out columns C:L with information, this is compiled into Column B into one string, which is the required title. I currently have a VBA script which works to do the changing name part, which is as below:
Although what I am looking to add is that each time there is a successful title change, that entire row is then copied across as values to the neighbouring worksheet titled "Image Details" in the next non-empty row (Column C must be filled in for each image if that wants to be used to reference the next non-empty row), and then the contents to be removed from said row (except for column B's values as this is a formula), I'd also be happy for the entire row to be deleted if that were more convenient.
Any help and suggestions would be much appreciated. I've tried finding a process myself, although have unfortunately been unable to create anything that works!
VBA Code:
Sub RenameFiles()
Dim sFolder As String
sFolder = ActiveWorkbook.Path & "\"
Dim m As Long
Dim v As Variant
m = Range("A" & Rows.Count).End(xlUp).Row
v = Range("A1:B" & m).Value
On Error GoTo ErrHandler
For r = 2 To m
Name sFolder & v(r, 1) & ".JPG" As sFolder & v(r, 2)
Next r
Exit Sub
ErrHandler:
MsgBox "Failed to rename " & v(r, 1), vbInformation
Resume Next
Exit Sub
End Sub
Although what I am looking to add is that each time there is a successful title change, that entire row is then copied across as values to the neighbouring worksheet titled "Image Details" in the next non-empty row (Column C must be filled in for each image if that wants to be used to reference the next non-empty row), and then the contents to be removed from said row (except for column B's values as this is a formula), I'd also be happy for the entire row to be deleted if that were more convenient.
Any help and suggestions would be much appreciated. I've tried finding a process myself, although have unfortunately been unable to create anything that works!