Merge UnMerge Cell Range in Excel VBA

Home/Excel VBA/Merge UnMerge Cell Range in Excel VBA


You can Merge UnMerge Cell Range in Excel VBA, it is required if you want to make bigger cells, instead of existing cell to fit your data and needs.



50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates

Merge UnMerge Range in Excel VBA – Solution:

Merge UnMerge Cell Range in Excel VBA We can use Merge and UnMerge methods of a Range to Merge UnMerge Cell Range in Excel VBA.

Merge UnMerge Cell Range in Excel VBA – Example:

Following is the example to show you how to merge or UnMerge the cells in excel using VBA.

Code to merge Cells
Sub sbMergeRange()
End Sub
Code to unmerge Cells
Sub sbUnMergeRange()
End Sub
  1. Open an excel workbook
  2. Press Alt+F11 to open VBA Editor
  3. Insert a Module for Insert Menu
  4. Copy the above code and Paste in the code window
  5. Save the file as macro enabled workbook
  6. Press F5 to execute it
By |July 7th, 2013|Excel VBA|4 Comments

About the Author:

Excel VBA Developer having around 8 years of experience in using Excel and VBA for automating the daily tasks, reports generation and dashboards preparation. Valli is sharing to helps us automating daily tasks.


  1. ali September 21, 2015 at 6:55 PM - Reply

    but i want to merge cells in two for loops based on i and j.
    for example,
    I want to merge (i,j) and (i,j+1)
    how is syntax here?

    • Cass January 22, 2016 at 9:18 PM - Reply

      You can dynamically reference cells using cells inside the range.
      My code usually looks like this:
      Range(Cells(row #, column #), Cells(Last row, Last column)

      Hope that helps.

  2. sam February 8, 2016 at 8:38 PM - Reply

    Cass, Thanks for the reply. Can you go one step further and show how to initiate a right, left or center justification of the merge.


  3. Janu September 9, 2016 at 12:21 PM - Reply


    i want to merge a particular rowcells with referring the merged cells in any column of that particular row kindly just the coding for that

Leave A Comment

Related pages

3d cluster chart excelvba excel close filevba copyfromrecordsethow to unlock excel filehow do i unhide columns in exceladvantages of ms excelexcel macro syntaxexcel vba datevalueeffort estimation template excelinputbox in vbavba open text fileif iserror formulavba excel left functionpivot chart excel 2007logical functions in excel 2010excel convert table to rangeexcel protect with passwordexcel mergerexcel vba columnssimple excel spreadsheet examplesboolean in vbaexcel vba endlearn vba macroshow to learn macros in excelwritten test questions and answers for fresherscount if formula excelvba as integerhow to find the duplicate rows in excelexample of excel macroexcel vba protectexcel macro cell referencemeeting agenda word templatehide worksheets in excelexcel vba subhow to filter out duplicates in excelvba select rowsusing vlookup function in excelsumif excel exampleshow to create data entry form in excel 2007vba pop upworksheet unprotecthow to enable data analysis in excel 2007vbscript copy foldervba in excel 2007 tutorial pdfexcel 2013 concatenatehow to create combobox in excel 2010vba delete columnstacked line chart excelascending in excelhow to edit protected excel filevb6 open text fileexcel templates for salesexcel autofit column widthhow do you unprotect an excel spreadsheetdelete duplicate row in excelsql ddl dml dcl tcl commandscount rows excelroadmap template excelexcel vba variable typesexcel formula for greater thanexcel macros basicshow do i find duplicates in excelhyperlink excel vbahow to use countif formula in excel 2007executive project dashboard templateuse excel to find duplicatesvba sumifs functionvba application.vlookupenable macros excel 2013excel vba querycall function in vbapassword protect excel 2010 workbookaverageifs examplecreating if statements in excelamazing excel spreadsheetscolorindex excel 2013