Concatenate values and separate them with comma in one row

romper

New member
Joined
Jun 18, 2017
Messages
3
Reaction score
0
Points
0
Hello,

I have different list of images names and want to concatenate them with static url path http://urlpath/

Images names are in column and when I click on any empty cell, I want to concatenate them with url path, separate them with comma and insert everything in one row.

concatenate1a.jpg
 

Attachments

  • images.xlsx
    10.1 KB · Views: 12
when I click on any empty cell
better to use double-click

insert everything in one row.
how about in the cell you double-click ?



Try experimenting with this in the sheet module
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target <> "" Then Exit Sub

Dim str As String, i As Long
Dim staticPath As String
Dim images As Variant

staticPath = Range("C14").Value
images = Range(Cells(7, 3), Cells(7, 3).End(xlDown)).Value

For i = 1 To UBound(images)
    str = str & staticPath & images(i, 1) & ","
Next i

Target = Left(str, Len(str) - 1)
Cancel = True
End Sub
 
Back
Top