Using VBScript to Find and Unmerge All Merged Cells in your Worksheet
HOW TO MERGE 2 CELLS IN EXCEL TOGETHER CODE
Copy and paste the above code into the module window. Once your VBA window opens, Click Insert->Module. From the Developer Menu Ribbon, select Visual Basic. Make sure you have the sheet you want to work on as the active sheet. Wherever it finds the MergeCells property set to True, it highlights the cell by setting its Style property to “ Note”.īelow are the steps to use the above VBA macro code: The above code will cycle through each cell in your active sheet’s working area. Make sure you have the sheet you want to work on as the active sheet. Here’s the code that we will be using: Sub findMergedCells() If you prefer to use VBScript to programmatically find and highlight/unmerge all the merged cells in your sheet, here is a super-easy way. Method 2: Using VBScript to find and highlight all Merged Cells in your Worksheet Now you can sort the data as it would not have any merged cells. This will instantly unmerge all the cells. Once you have found all the merged cells in your sheet, you can decide to unmerge these cells so that they become easier to work with.įor this Go to the Home tab and click on the ‘ Merge & Center’ button. Unmerging all Merged Cells in your Worksheet Now you can clearly see which cells are merged.Īt this point, it’s up to you to decide if you want to delete these cells, replace them or simply unmerge them. You can now choose to highlight all the merged cells so that you can decide what to do with the cells.įor this, select one of the styles from the Styles group under the Home tab (or choose any other cell color in which you want to highlight the merged cells). The above steps will help automatically select all the merged cells in your sheet. The above steps would instantly select all the cells that are merged in the dataset Highlighting all Merged Cells in your Worksheet Press the Close button to close the ‘ Find and Replace’ dialog box. This will cause all your merged cells to get selected simultaneously. Select all these listed cells by selecting the first list item, and pressing down on the SHIFT key, select the last item. You will see a list of all the cells that are merged in your selected range. This will bring you back to the ‘ Find and Replace’ dialog box. Select the Alignment tab and from the Text Control options, check the “ Merge Cells” option. This will open the ‘Find Format’ dialog box. Now click on Format (next to the ‘ Find What’ input field). In the ‘ Find and Replace’ dialog box, select Options. Alternatively, you can press the CTRL+H keys on your keyboard to directly open the ‘ Find and Replace’ dialog box. From the Home tab, under the ‘ Editing’ group, select ‘ Find and Select’. Select the range of cells in which you want to find merged cells. Now to find these merged cells, you can use Find and Replace as follows: Moreover, cell A5 has been merged with cell A6. In this dataset, cell C1 has been merged with cell D1. Let’s say you have the dataset shown below: The Find and Replace feature provides a great way to select merged cells in Excel. Method 1: Finding Merged Cells Using ‘Find and Replace’ Use Center Across Selection to Avoid Merging Cells. Using VBScript to Find and Unmerge All Merged Cells in your Worksheet.Method 2: Using VBScript to find and highlight all Merged Cells in your Worksheet.Unmerging all Merged Cells in your Worksheet.Highlighting all Merged Cells in your Worksheet.Method 1: Finding Merged Cells Using ‘Find and Replace’.
Once you have found the merged cells, you can further process them by either unmerging them, highlighting them, or removing them. In this Excel tutorial, we will show you two quick and easy ways in which you can use to find merged cells in your worksheet, even if it is a large one.
Sometimes merged cells may cause disturbances in your VBA code too. When you need to count cells that contain merged cells. When you need to copy a range of cells that may contain merged cells. When you need to use references to merged cells in formulas. When you try to sort cells that contain merged cells. Here are some cases in which Excel does not allow you to perform operation due to the presence of merged cells: It becomes even tougher when you are dealing with large datasets where there can be multiple instances of merged cells. Merged cells are often so subtle in appearance that it’s difficult to hunt them down one by one. You might have encountered times where you find Excel not letting you perform certain operations on your data due to the presence of merged cells.