Add a button to the worksheet, using the Developer ribbon (Form controls), and assign it to a macro that changes the background color of selected cells to green.
Remember that in most cases there is more than one way to solve the exercise.
Hint: It is possible to use the RGB color model to define the background color of cells.
In this case, it is necessary to make the cells already selected by the user to the green color. We can solve this by using the macro recorder, with the relative references option enabled , and also with the Selection. concept. In either case it is preferable to associate the macro with a buttons with macro.
In this case, the cells that were previously selected before running the macro will change to green.
Sub Solution() Selection.Interior.Color = RGB(140, 198, 63) End Sub
SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.
Excel ® is a registered trademark of the Microsoft Corporation.
© 2023 SuperExcelVBA | ABOUT