Now, whenever you'll press CTRL+j, all selected cells will be merged. Selection.VerticalAlignment = xlCenter ' to align text vertically in center Selection.HorizontalAlignment = xlCenter ' to align text horizontally in cent
Selection.VerticalAlignment = xlCenterįinally, your code will look like this, Sub mergeCells() If you instead want to merge and center then add this line in macro Selection.HorizontalAlignment = xlCenterĪnd if you want to the text to be in the center of the cell vertically too, add this line too.
Selection.Merge 'to merge selected cells.
now copy below line to only merge cells in between sub and end sub().Select mergeCellsShortcut and click on Edit.Click on Macros in Developer Tab or press ALT+F8 the list of available macros will appear.Now stop recording from the developer tab or status bar.If you want your shortcut to merge and center to work on every workbook then choose Personel Macro Workbook. If you want this macro to run on the current file then choose This Workbook in 'Store macro in:' section.if you want to involve SHIFT KEY, press SHIFT+J. I will use this as my shortcut of Merging cells.
There are some keys that are free in excel, Like CTRL+j. If you define any shortcut that is already defined then this will override the previous one.
To merge and center two or more cells follow these steps: Sequential Merge and Center shortcut in excel (ALT>H>M>C) The traditional way is lengthy and there is no simple shortcut to merge and center, like CTRL+C for copying. So when you work dashboards, you get the need for Merge and Center cells. This is used to combine multiple cells into a single cell and create the main headers for reports in Microsoft Excel. This is a great way to create a label that spans multiple criteria. Knowledge is power - if you don't know what's available you can miss an opportunity or spend hours trying to jury-rig a solution by cobbling together other functions.Merge & Center combine and center the contents of the selected cells in a new, larger cell. You can't add these to any favourites list but you can make your own "Check these out" list Similarly, open the Function Wizard window and check out the functions available (made easier bc you can do so by category). If so, add it to your QAT and try it out.Ģ.
open the Customize Quick Access Toolbar window and just scroll through the list of commands available (Note: some are only available thru customisation as they are not on the inbuilt menu!) and see what each tool does and whether it may be useful to you. I'm from the same era: Learned 123 in 1984/85 from a 5.25" floppy tutorial, & Multiplan, then progressed thru Symphony, Supercalc, back to 123, and then Excel 4 & 5 in 1995 - and have never looked back! That's the beauty and ugliness of Excel - there are more tools & features than you can ever learn or know about!