how can I set color to excel sheet cell using excel advance action, as their is not any action present to set color. It is only present to office 365 Excel action package.
How can I set color to excel sheet cell using excel advance action?
how can I set color to excel sheet cell using excel advance action, as their is not any action present to set color. It is only present to office 365 Excel action package.
Hi Kaif you can use Macros(VB script)
use Run Macro Action in Excel advanced actions
![](https://uploads-us-west-2.insided.com/automationanywhere-en/attachment/57febcd5-9ee5-48ee-b52a-55c1122712dc.jpg)
script Example:-
Sub SetA1RedColor()
Range("A1").Font.Color = RGB(255, 0, 0) ' RGB values for red color
End Sub
Note :- Above code used to put red color in only A1 cell
To use this macro, you need to follow these steps:
Press Alt + F11 to open the VBA editor in Excel.
Insert a new module by clicking Insert in the menu and selecting Module.
Copy and paste the above code into the code window on the right.
Close the VBA editor.
Press Alt + F8 to open the Macro dialog box.
Select the "SetA1RedColor" macro from the list and click Run.
Once you run the macro, cell A1 in the active sheet will have red font color. You can modify the RGB values in the code to set a different shade of red if desired.
or
1.use Simulate keystrokes action in keystrokes:- ALT + H + H
2.then again use Simulate keystrokes action in keystrokes:- M
3.use mouse Action to select exact location of your color.
You can use Excel advanced run macro command using below macro. Also by keeping the counter of the cells you can call this dynamic macro.
Sub ColorCell()
' Get the selected cell
Dim selectedCell As Range
Set selectedCell = Selection
' Set the fill color of the selected cell to yellow
selectedCell.Interior.Color = RGB(255, 255, 0)
End Sub
To use this macro, follow these steps:
- Press
Alt + F11
to open the Visual Basic for Applications (VBA) editor. - Insert a new module by clicking
Insert
>Module
. - Copy and paste the above code into the module.
- Close the VBA editor.
- Select the cell you want to color. (I hope you know your cell in the code)
- Press
Alt + F8
to open the "Macro" dialog box. ( using keystrokes) - Select the "ColorCell" macro from the list and click "Run". ( using keystrokes)
The selected cell will be colored with a yellow fill. You can modify the RGB values in the code to change the color to your preference.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.