+ Reply to Thread
Results 1 to 16 of 16

Macro Needed to Concatenate Data in separate ROWS

  1. #1
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Smile Macro Needed to Concatenate Data in separate ROWS

    Hello



    I would need a macro that can do this show in the file I've attached.
    I need a macro that can concatenate data in separate rows......



    Very thanks for help
    Attached Files Attached Files
    Last edited by 823; 02-06-2015 at 12:41 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro Needed to Concatenate Data in separate rows

    This will put results on sheet2:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro Needed to Concatenate Data in separate rows

    Duplicate thread, one response in each!

  4. #4
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate rows

    Thanks for reply

    COnsidering the file I've attached; What I have to insert in "Sheet1.Range("A9")"
    and in "Sheet2.Range("A1")".

    I need to modify something else?


    thank you

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro Needed to Concatenate Data in separate ROWS

    Sorry, not sure what you're asking. A9 is the top left cell of your starting data and Sheet2 is where the results are placed so either can be vared.

  6. #6
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate ROWS

    Sorry you.....but I'm newbe of excel macro....


    so to apply the macro:
    I open my file
    I open Visual Basic
    On sheet 1 I paste the code you've written above
    I saved the file in excel-macro format,,,,

    then I click "play"

    But it retourns error "object needed"




    thanks
    Last edited by 823; 02-06-2015 at 12:52 PM.

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro Needed to Concatenate Data in separate ROWS

    Here are instructions for how to run a macro:

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

  8. #8
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate ROWS

    ....Thanks Stephen...

    It give me this error:

    "Object needed/missing"

  9. #9
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate ROWS

    When I press alt+f8 It says

    runtim error 424
    object needed


    Someone can help me plz?

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Macro Needed to Concatenate Data in separate ROWS

    What is Office 2015 in your office version?

  11. #11
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate ROWS

    I made a mistake.....I mean I have office 2007 in a pc, and in another pc, office 2013....


    But In your pc, with my file attached in the first post, this string:

    Sub x()

    Dim vOut(), vIn(), i As Long, n As Long

    vIn = Sheet1.Range("A9").CurrentRegion.Value
    ReDim vOut(1 To UBound(vIn, 1), 1 To 2)

    With CreateObject("Scripting.Dictionary")
    For i = 1 To UBound(vIn, 1)
    If Not .Exists(vIn(i, 1)) Then
    n = n + 1
    vOut(n, 1) = vIn(i, 1)
    vOut(n, 2) = vIn(i, 2)
    .Add vIn(i, 1), n
    ElseIf .Exists(vIn(i, 1)) Then
    vOut(.Item(vIn(i, 1)), 2) = vOut(.Item(vIn(i, 1)), 2) & "-" & vIn(i, 2)
    End If
    Next i
    End With

    Sheet2.Range("A1").Resize(n, 2) = vOut

    End Sub
    Does it works???


    In my no!! ...I retoruns 424 error / object missing



    thanks for help
    Last edited by 823; 02-07-2015 at 05:17 AM.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Macro Needed to Concatenate Data in separate ROWS

    Try the attached
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate ROWS

    Quote Originally Posted by jindon View Post
    Try the attached
    Please Login or Register  to view this content.
    It works PERFECT ....VERY THANKS JINDON !!!!

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Macro Needed to Concatenate Data in separate ROWS

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  15. #15
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate ROWS

    I've done jindon



    THANKS!!!

  16. #16
    Registered User
    Join Date
    02-06-2015
    Location
    Italy
    MS-Off Ver
    Office 2007 & 2013
    Posts
    78

    Re: Macro Needed to Concatenate Data in separate ROWS

    .........................

    I opened a new thread because I need a little mod. of this macro



    http://www.excelforum.com/excel-prog...ml#post3996039
    Last edited by 823; 02-21-2015 at 12:29 PM. Reason: open new thread

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to separate, concatenate, and change sheet names
    By JGSmith in forum Excel General
    Replies: 16
    Last Post: 05-04-2014, 04:57 AM
  2. Macro needed for capturing data corresponding to empty rows
    By rajkumarmp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2013, 09:36 AM
  3. Help needed in using concatenate function in Excel macro
    By bintoca in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2013, 09:50 AM
  4. [SOLVED] VBA/Macro help needed for splitting wrapped cell values into separate (bottom) rows
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 01:30 PM
  5. Loop macro for multiple separate graphs from rows of a large data set
    By GlennToms in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2012, 02:12 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1