![]() Excel for mac os. Supposing you need to deselect some cells or ranges from current selections, you have to unselect the whole selection, and reselect again, because Excel does not offer a way to deselect cells once they have been selected. And this article will list some tricky guidance to deselect part of cells or ranges from the current selection. 222 Excel shortcuts for Windows and Mac Windows shortcuts in dark gray on the left, Mac shortcuts in white on the right. See also: The 54 Excel shortcuts you really should know and Excel shortcuts on the Mac. From: Sometimes, there are two adjoining cells need to be swapped. We can manually do it easily. Look at the following screenshot, I want to swap cell A4 and B4, please do as follows: • Select the cell you want to swap. In this example, select cell A4. • Press Shift key, and put the cursor at the right border. • Then drag the cursor to the right border of cell B4. • When there displays “工”, release the mouse. • And the two cell contents have been swapped. With this method, we can also swap two adjoining rows or columns. By easy, I mean either a keyboard shortcut or menu item, without involving copying to temporary cells or writing VBA scripts or anything like that. I'm looking for a way to just select two cells and click some menu item or press some key combination that will swap their contents. Why impose this restriction? Creating a macro makes this trivial. As far as I know, it can't be done any other way. You can assign the macro to a button or hotkey. Sub Swap() If Selection.Count 2 Then MsgBox 'Select 2 cells (only) to swap.' Exit Sub End If Set trange = Selection If trange.Areas.Count = 2 Then temp = trange.Areas(2) trange.Areas(2) = trange.Areas(1) trange.Areas(1) = temp Else temp = trange(1) trange(1) = trange(2) trange(2) = temp End If End Sub. I read this post but actually needed a macro to swap full ranges. In addition, I needed to swap the colors. Modded the originally posted macro slightly, this might be useful for someone. Sub Swap() If Selection.Areas.Count 2 Then MsgBox 'Select 2 cell ranges (only) to swap.' Exit Sub End If If Selection.Areas(1).Count Selection.Areas(2).Count Then MsgBox 'The two areas must be of equal size' Exit Sub End If 'With this for loop we run through each cell 1 by 1 For i = 1 To Selection.Areas(1).Count 'Swapping values temp = Selection.Areas(1)(i) Selection.Areas(1)(i) = Selection.Areas(2)(i) Selection.Areas(2)(i) = temp 'Swapping color tempColor = Selection.Areas(1)(i).DisplayFormat.Interior.Color Selection.Areas(1)(i).Interior.Color = Selection.Areas(2)(i).DisplayFormat.Interior.Color Selection.Areas(2)(i).Interior.Color = tempColor Next i End Sub. Advertisement When you want to combine two cells into one in Excel, you have a few options. Merging cells is one of the best ways to do it. But it has a few drawbacks, too. Even so, you might find that it’s useful for. We’ll take a look at how to merge cells in Excel, how to unmerge them, and another method for combining two cells into one without losing the data in the cells. How to Merge Cells in Excel Before we get into how to merge cells, let’s talk about exactly what happens when you merge in Excel. In this example, we’ll look at two columns, one for first name and one for last name: When we merge two of these cells, we end up with the contents of those cells in a single cell, like this. The two cells have been combined, leaving a single cell that’s twice as wide and only contains one value. Excel only keeps the upper-left value of any merged cells. That’s one drawback to merging in Excel. We’ll talk about how to get around that in a moment. To merge cells in Excel, select the cells you want to merge. You can select any number of cells; in our example, we’ll select just two. Once you’ve selected the cells, head to the Home tab and click Merge & Center in the Alignment section: If you’ve selected more than one with text in it, you’ll get a warning. After clicking Merge Across, you’ll receive another warning from Excel. But instead of a single warning, you’ll get one warning for each row in your selection. Which is a lot. After clicking OK for each row, you’ll have a newly combined column: You might be wondering why you wouldn’t just delete the second column in this case. Well, you probably would. Merging columns doesn’t do a whole lot for you. Let’s talk about a better way to merge cells in Excel. Combining Cells With CONCATENATE The fact that combining cells makes you lose data is a big disadvantage of using Excel’s merging function. However, you can get around that by using a formula. Here’s the syntax of the CONCATENATE function, one of: =CONCATENATE(text 1, [text 2].) The function takes multiple text inputs and creates a new cell that combines all of them. This lets you merge cells without losing any data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |