Solved how can find/create shortcut for merge and center in excel

Dell / Inspiron n4020
April 16, 2014 at 05:21:49
Specs: Windows 7, 2.3 GHz / 3544 MB
I have got big list in which I have to merge 3-4 rows into one row, lists are very big and I have to spend hours merging these rows into one row.

is there an easy way to merge these row without repeating the same commond
is there any shortcut key for merge and center in excel 2010 if not can I make the one.

Abdul Naseer Ansari
Afghanistan


See More: how can find/create shortcut for merge and center in excel

Report •


#1
April 16, 2014 at 05:35:54

Report •

#2
April 16, 2014 at 12:59:30
✔ Best Answer
In Excel 2010 Alt HMC will Merge and Center the selected Cells/Rows.

You could also select the first set of Rows and record a macro, assigning it a Ctrl key sequence. That Ctrl key sequence will then perform the same action on any given range of Selected cells.

When I recorded a macro while using Merge and Center, I got this:

Sub Macro2()
'
' Macro2 Macro
'

'
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
End Sub

You could also write a custom macro so that you didn't have to select the rows to be merged, but that might be difficult since you said "I have to merge 3-4 rows into one row".

Macros are great for simplifying operations when there is a consistant pattern to follow. If you are trying to merge 3 rows some times, 4 rows some other times, etc. it would be hard to have a macro that could be used to do all of your merges automatically with a single run. How would it know what you wanted to merge at any given time/location in the spreadsheet?

If there was a consistant pattern, such as Merge rows 1:3, 11:13, 21:23, etc. then something like this would work:

Sub Merge3Rows_Every10Rows()
'Initialize Start and End Row variables 
 srtRw = 1
 endRw = 3
'Loop through rows, Merge and Center
  For x = 1 To 10
    With Rows(srtRw & ":" & endRw)
      .HorizontalAlignment = xlCenter
      .MergeCells = True
    End With
'Increment Start and End Row variables by 10
      srtRw = srtRw + 10
      endRw = endRw + 10
  Next
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions


Ask Question