+ Reply to Thread
Results 1 to 5 of 5

Merge cells based on other cell's content

  1. #1
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Merge cells based on other cell's content

    Hi,

    I need some code that would merge cells in column C where the values in column B are the same

    Any help is greatly appreciated

    Kevin
    Attached Files Attached Files

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Merge cells based on other cell's content

    as this no doubt is part of a greater application, will you be using formula or VBA/macros on the final range.
    if so please reconsider the use of merged cells - they can and do present cell referencing problems when data handling.
    I know they make a sheet look 'pretty' but sacrifice 'looks' so that Excel can perform logically.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: Merge cells based on other cell's content

    The final range will not have formula or VBA.

    Thanks

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi, try this !


    According to your attachment a VBA demonstration as a beginner starter :

    PHP Code: 
    Sub Demo1()
            
    Dim Rg(1) As Range
        With Range
    ("B4", [B4].End(xlDown))
            
    Set Rg(0) = .Cells(1)
         Do
            
    Set Rg(1) = .Find(Rg(0), , , 1, , 2)
             If 
    Rg(1).Row Rg(0).Row Then Range(Rg(0), Rg(1)).Offset(, 1).Merge
            Set Rg
    (0) = Rg(1)(2)
         
    Loop Until IsEmpty(Rg(0))
        
    End With
            Erase Rg
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon ? Add Reputation ? !

  5. #5
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: Merge cells based on other cell's content

    Thank you Marc, it works great

    Kevin

+ 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. Merge content of two, three cells
    By mkosa in forum Excel General
    Replies: 6
    Last Post: 08-08-2015, 12:48 PM
  2. Automatically copy cells content based on the content of another cell.
    By chrisbarlow1984 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-01-2014, 11:13 AM
  3. VBA to merge cells with identical content
    By juangar1992 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2013, 04:05 PM
  4. Merge cells with same content
    By rainbowforest in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-02-2011, 03:33 AM
  5. merge and reset a merge based on cell content
    By salkovsg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2007, 07:08 PM
  6. Replies: 2
    Last Post: 01-29-2007, 12:14 AM
  7. [SOLVED] Excel should merge cells without removing content of any cell
    By Rumpa Biswas in forum Excel General
    Replies: 14
    Last Post: 12-31-2005, 08:35 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