Append Cell Data with .jpg

tomgrandy

New Member
Joined
May 10, 2024
Messages
41
Office Version
  1. 365
Platform
  1. MacOS
This may seem incredibly easy, but as a beginner, I could use some help writing a Macro with VBA.

I have several cells with a path written on the server and need to append the numbers at the end of the path with .jpg as shown below. There are about 450 in each column.

Humbly thanks,
Tom


Excel Formula:
[TABLE]
[TR]
[TD]IMAGE_1[/TD]
[TD]IMAGE_2[/TD]
[TD]IMAGE_3[/TD]
[/TR]
[TR]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/1[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/1[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/1[/TD]
[/TR]
[TR]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/2[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/2[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/2[/TD]
[/TR]
[TR]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/3[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/3[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/3[/TD]
[/TR]
[TR]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/4[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/4[/TD]
[TD]http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/04-02-24/4[/TD]
[/TR]
[/TABLE]
 

Attachments

  • Screenshot 2024-09-24 at 1.19.51 PM.png
    Screenshot 2024-09-24 at 1.19.51 PM.png
    144.7 KB · Views: 4
Last edited:
Another way. The appending is done in computer memory so will be faster. Not noticeable with small amounts of data though.
Code:
Sub With_Array()
Dim lr As Long, datArr
Dim i As Long, j As Long
lr = Range("I:L").Find("*", , xlValues, , xlByRows, xlPrevious).Row
datArr = Range("I2:L" & lr).Value
    For i = LBound(datArr, 2) To UBound(datArr, 2)
        For j = LBound(datArr, 1) To UBound(datArr, 1)
            If Not datArr(j, i) = vbNullString Then datArr(j, i) = datArr(j, i) & ".jpg"
        Next j
    Next i
Cells(2, 9).Resize(UBound(datArr, 1), UBound(datArr, 2)).Value = datArr
End Sub
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,223,939
Messages
6,175,531
Members
452,651
Latest member
wordsearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top