Consulting

Results 1 to 5 of 5

Thread: Concatenate in VBA

  1. #1

    Concatenate in VBA

    Hi,

    Could you please help me code for below scenario:

    I have 3 columns (E, I, M) in Sheet 2 . I would like to concatenate these 3 columns and place in sheet 1 of Column H.


    Thanks and regards,
    Sri
    Last edited by murthysri272; 02-11-2016 at 04:03 PM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    With Worksheets("Sheet2")
    
    For i = 2 To .Range("E2").End(xlDown).Row
    
        j = j + 1
        Worksheets("Sheet1").Cells(j, "H").Value = .Cells(i, "E").Value & " " & _
                                                                   .Cells(i, "I").Value & " " & _
                                                                   .Cells(i, "M").Value 
    Next i
    End With
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Hi,
    It working fine. But if My result should come from H20, how can i achieve it?


    Thank you,


    Regards,
    Sri

  4. #4
    Hi,
    Thanks for your help.

    I got my desired result now with below code.


    Sub Concat()
            With Worksheets("Conversion Table")
                For i = 5 To .Range("E2").End(xlDown).Row
                    j = j + 1
                     Worksheets("HYPERION").Range("I20:I3000")(j).Value = .Cells(i, "I").Value & "" & _
                    .Cells(i, "M").Value & "" & _
                    .Cells(i, "E").Value
                    
                Next i
            End With
    End Sub


    Thanks a lot for your help!

    Thanks again.



    Regards,
    Sri
    Last edited by SamT; 02-12-2016 at 01:39 PM.

  5. #5
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Worksheets("HYPERION").Range("I20:I3000")(j)
    Worksheets("HYPERION").Cells(1 + 15, "I")
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

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