Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Excel: Automatically Add Image Extension ".jpg" or Insert Image Path

Hi everyone in this tutorial I will teach you how to create a very simple yet a life-saving excel Macro. If you’re a Product Lister you might have experienced working on excel sheet with thousands of images file names or image path, updating them one by one, so tiresome right? 

But good news for you, I have discovered the easiest way to do that through excel’s own tools for designed repetitive task, the MACROS
--Add any image extension to any image name.
--Add additional text or path name before the image name.
--Select and run. Easy to customize.

1. First create a new macro, click the Excel's Developer Tab > Record.

2. Name your macro as RENAMER then, hit OK.
3. Click the MACROS menu —Microsoft Visual Basic module dialog will open

4. Between the Sub Renamer and End Sub add this line:
Dim Cell As Range
For Each Cell In Selection
If Not IsEmpty(Cell) And Right(Cell, 4) <> "..jpg" Then
Cell = "" & Replace(Trim(Cell), "", "-") & ".jpg"
End If
Next Cell
5. Press CTRL + S to save your code.

6. To run your macro, select an excel column with image file names that you want to add .JPG extension, then run your Renamer macro as shown:


Adding an Image Path
1. Just open your RENAMER macro and click the EDIT menu then add the image path inside the quote next the cell=.
Your final code will look like this:
Dim Cell As Range
For Each Cell In Selection
If Not IsEmpty(Cell) And Right(Cell, 4) <> "..jpg" Then
Cell = "www.yourdomain.com /images/" & Replace(Trim(Cell), "", "-") & ".jpg"
End If
Next Cell

Here’s the screenshot using my fictitious image path.


Warning: The only problem with using this macro is can’t undo anymore after you run it. So you better careful by backing up your file.

6c0a267393074ceebbb6b3ba03a69d32


This post first appeared on Nebgek | Tech Web Dev & Virtual Stuffs, please read the originial post: here

Share the post

Excel: Automatically Add Image Extension ".jpg" or Insert Image Path

×

Subscribe to Nebgek | Tech Web Dev & Virtual Stuffs

Get updates delivered right to your inbox!

Thank you for your subscription

×