Hi,
In this article you will learn about how to merge cells quickly in excel by using micro. You can save your time by using this easy method so the below steps you can follow to merge cells in excel very quickly.
• Open the sheet where you wanna merge cells
• Go to view tab>> Micros>>Record Micro>>Click ok
• Go back to view tab >> Micros >> Click on Stop Recording
• Go back to data sheet, select the area you want to merge
• Open >> Micros >> View Micros and click on run
Hope you will find this video useful...!
Thank you
VBA Code:
Option Explicit
Sub Merge_Same_Cells()
Application.DisplayAlerts = False
Dim rng As Range
MergeCells:
For Each rng In Selection
If rng.Value = rng.Offset(1, 0).Value And rng.Value <> "" Then
Range(rng, rng.Offset(1, 0)).Merge
Range(rng, rng.Offset(1, 0)).HorizontalAlignment = xlCenter
Range(rng, rng.Offset(1, 0)).VerticalAlignment = xlCenter
GoTo MergeCells
End If
Next
End Sub
Post a Comment