Results 1 to 2 of 2

Thread: Concatenate values and separate them with comma in one row

  1. #1

    Concatenate values and separate them with comma in one row



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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.

    Click image for larger version. 

Name:	concatenate1a.jpg 
Views:	22 
Size:	43.4 KB 
ID:	6984
    Attached Files Attached Files

  2. #2
    Magician NoS's Avatar
    Join Date
    Jan 2013
    Location
    British Columbia
    Posts
    832
    Articles
    0
    Excel Version
    Excel 2010
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •