+ Reply to Thread
Results 1 to 6 of 6

Merge number of cells based on cell value

  1. #1
    Registered User
    Join Date
    03-19-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    6

    Merge number of cells based on cell value

    Hi All, I am new to VBA. Need some help in writing a macro which merges number of cells downwards based on a value entered in a specific cell. For example, if cell A1=5 then I want to merge B1:B5 or any other range. Request you to provide a full solution with codes.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Merge number of cells based on cell value

    Does this help?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-19-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Merge number of cells based on cell value

    Hi John, yes it works. I found another method as well, but yours looks better and short. And I like the macro name. :D :D. Thanks for the help!
    Please Login or Register  to view this content.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Merge number of cells based on cell value

    THis is not an answer to your question, but some advice. You should try to avoid merging cells whenever possible, they cause all sorts of problems with formulas, and there are often other ways around merging
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    03-19-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Merge number of cells based on cell value

    Hi Ford, advice taken. Actually this code will be a part of a bigger macro which will make calculations and prepare a grid view based on the inputs. Must say, this site is quick in responses.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Merge number of cells based on cell value

    As long as you are aware of the potential pitfalls

    We try to be on the ball

+ 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. [SOLVED] Merge cells in a table based on number of common values
    By saidineshbabu in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-17-2013, 11:21 AM
  2. how to merge cells based on the value of another cell?
    By 2unlink in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-25-2013, 01:58 AM
  3. [SOLVED] Need to merge cells few blank cells based on a value of a cell in the same row
    By skandkamat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2013, 01:33 AM
  4. Need to merge variable number of cells into one single cell based on criteria
    By NewYorkVanilla in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-20-2009, 11:05 AM
  5. Merge cells based on number of characters
    By Horace1894 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2009, 10:37 AM

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