+ Reply to Thread
Results 1 to 9 of 9

VBA concatenate selected cells

  1. #1
    Registered User
    Join Date
    07-04-2011
    Location
    London England
    MS-Off Ver
    Excel 2013
    Posts
    71

    VBA concatenate selected cells

    Hello
    I am not having much luck finding some code to concatenate selected cells in a worksheet. Ideally, the contents of each cell will need separating with a space. The result would then need wrapping and placing in the first cell of the range selected.
    Many thanks in advance.

  2. #2
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: VBA concatenate selected cells

    Hi there,
    give more details:
    f.e. You want to select columns A,B,C and return concantenated result to col A?
    Or You want to only select column A, where the result has to be returned?-Which columns has to be concantenated?
    Regards
    Miroslav R.

    (If You like my solutions, feel free to add reputation.)

  3. #3
    Registered User
    Join Date
    07-04-2011
    Location
    London England
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: VBA concatenate selected cells

    Hello
    Just the cells that are selected. This may be A3 to A7 (for which the result would be in A3) or G9 to G11 for which the result would be in G11.

  4. #4
    Registered User
    Join Date
    07-04-2011
    Location
    London England
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: VBA concatenate selected cells

    Apologies, Result in G9, not G11

  5. #5
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: VBA concatenate selected cells

    Hi there,

    look at this code:
    Please Login or Register  to view this content.
    MinRow & MinCol are the only for the reason, You will select Your range from the bottom. This will put the result in the top cell.
    If You are going to select ONLY from the top, You can use this shotened version:
    Please Login or Register  to view this content.
    I recomend You to put any of these two SUBs on shortcut key.

    Hope it helps

  6. #6
    Registered User
    Join Date
    07-04-2011
    Location
    London England
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: VBA concatenate selected cells

    Hello
    That really helps. Is it possible to clear the cells after the code has been run other the the top one where all the contents is now shown?

  7. #7
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: VBA concatenate selected cells

    Hi there,
    Yes it is:
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-04-2011
    Location
    London England
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: VBA concatenate selected cells

    What can I say. It works perfectly. Thanks for your time.

  9. #9
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: VBA concatenate selected cells

    You are welcome!

    If You like my solution, add reputation if You want (bottom left corner of my posts).

    An mark this thread as SOLVED... ;-)

    Have a nice day!

+ 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. Concatenate selected columns
    By verokarhu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2013, 11:31 AM
  2. [SOLVED] Return row 1 information if selected and concatenate
    By rmack1272 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-07-2012, 02:54 PM
  3. Replies: 2
    Last Post: 04-12-2010, 12:35 PM
  4. Concatenate a selected Range?
    By CLR in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-08-2006, 06:30 AM
  5. Macro to concatenate previously selected cells
    By Grumpy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2005, 08:55 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