Where with the help of RGB we could get color of any shade, just by putting the different values for Red, Green and Blue colors. But by this process, we can only get the main basic color as the font color. For this, we will consider the same text as shown in example-1 located in cell B3.Īpart from RGB, we can change the color of fonts with the keyword “ vb” followed by the name of the color. There is another way of changing the font color in VBA. We will apply font color for text which is in cell B3 and now changed from Black to Green color. Step 7: Now compile the code to find if it has any error and then run by clicking on the play button located below the menu bar. As per that, considering Red at 20, Green at 230 and Blue at zero as shown below. Step 6: Let’s give the largest value to Green color and least to Red and zero to Blue color. As we already have the black color font we will try to select some other color. Suppose we need to change to a color font to Black then RGB value will be RGB(0, 0, 0). Numeric values of each color range from 0 to 255. Now to understand the formation of any color, in VBA we have RGB i.e. ![]() Step 5: After that, we will select the command Color separated by a dot (.) as shown below. Step 4: As we need to change the color of fonts so we will select the Font command with the help of Selection as shown below. Here, our range will be cell B3 and that will be written followed by “.Select” command as shown below. Step 3: First select the range of the cell where the text is located.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |