Using VBScript to Find and Unmerge All Merged Cells in your Worksheet
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.
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.