REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

Description:

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.

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()

Range("A1:B3").Merge

End Sub
Code to unmerge Cells
Sub sbUnMergeRange()

Range("A1:B3").UnMerge

End Sub
Instructions:
  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
Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: Excel VBATags: Last Updated: June 17, 2022

4 Comments

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

    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?

  2. Cass January 22, 2016 at 9:18 PM

    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.

  3. sam February 8, 2016 at 8:38 PM

    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.

    Thanks,
    Sam

  4. Janu September 9, 2016 at 12:21 PM

    hi,

    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
    Regards,
    Janu

Leave A Comment