Let’s use Red color this time starting with vb as shown below. Step 5: Again, we will use VBA base colors for cell font colors. By this, we would be able to select the color which we want to give to selected cell fonts. Step 4: Now with the help of Selection use Font.Color function together as shown below. We will again use the same line of code here. Step 3: Again insert any text as we have seen in example-1. Here, we are again considering the same range. Step 2: Again select the range of cells where we want to see all this happening. In this example, we will insert a text in any range of cells and simultaneously we will change the font color for those cell text as well. For this, follow the below steps: We will see, our selected range of cells are colored as Green. Step 5: Now again run the code by pressing F5 key or by clicking on the Play Button. Let’s consider the interior color to be Green as shown below. To select any base color we will use vb followed by the name of the color. Step 4: Here we have a variety of colors but all are BASE COLORS. This will allow us to use all available vb Color we have in VBA. Step 3: Now for changing the interior color of any cell, we need to use Interior.Color function together along with Selection. Step 2: Select the range of required cell, which is from cell A1 to C3 here. Step 1: Write the subcategory of VBA Selection or in any name as per your choice as shown below.Īgain, we will keep on using the same range of cells as we have seen previously with the same inserted text. In this example, we will see how could we use and change the cell’s interior color with the help of VBA Selection. And we had used Select command so that range is in a current selected mode. We will see, now our new selection will be from cell B2 to D4 as shown below. Step 5: Now again run the code by pressing F5 key or by clicking on Play Button. Let’s try to move it by 1 row and 1 column away from the current position. Step 4: After that select the offset location where we want to move the selection box from range cells A1 to C3. By this Offset function, we would try to offset or move the selection from the next matrix. Step 3: Now choose Offset function along with Selection as shown below. Step 2: Select the range of cell as per your need or else we can keep off using the same range of cells which we had seen in the above example. Step 1: Write the subcategory of VBA Selection as shown below. In this example we will see, how Offset function will work along with VBA Selection. We will see, from cell A1 to C3, our selected text value has been inserted and the whole is selected as well. Step 6: Now run the code by clicking on the Play button which is placed below the menu bar as shown below. Step 5: At last, we will write any text which we would like to see in the selected range of cell. This is used for selecting the cells for putting the value in. For this in the next line of code write Selection.Value. Step 4: Now, we would try to insert some text in the selected range of cell.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |