Hello all,
I have put together a Macro to look at an image folder on my server and check if an image exists, the item code would be in cell a2 and down, the file name is always the product code + .jpg.
I have appx 30,000 rows on my sheet and appx 14,000 images. i am looking to endup with only a list of the products i do NOT have an image for.
Could someone cast an eye over the code below? it will cycle through each line and as i step through each step it will go to the delete option when there is no image but the row remains untouched. :(
I have put together a Macro to look at an image folder on my server and check if an image exists, the item code would be in cell a2 and down, the file name is always the product code + .jpg.
I have appx 30,000 rows on my sheet and appx 14,000 images. i am looking to endup with only a list of the products i do NOT have an image for.
Could someone cast an eye over the code below? it will cycle through each line and as i step through each step it will go to the delete option when there is no image but the row remains untouched. :(
Code:
Sub check_for_image()
Dim myDir As String
Dim myCell As String
Dim myCount As Single
myCount = 2 'mycount is the starting row that the file names start at
myDir = "\\server\images\large\" 'Change this to the location that the files are in
Do
myCell = Range("a" & myCount) 'Change this A to the Column you want to read
If Len(Dir(myDir & myCell & "*.jpg")) > 0 Then
Range(myCell).EntireRow.Delete
End If
myCount = myCount + 1
Loop Until IsEmpty(Range("a" & myCount)) 'Will loop until the first empty cell
End Sub