Skip to main content
Solved

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.

2 replies

Userlevel 3
Badge +5

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

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:- 

3.use mouse Action to select exact location of your color.

Badge

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:

  1. Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
  2. Insert a new module by clicking Insert > Module.
  3. Copy and paste the above code into the module.
  4. Close the VBA editor.
  5. Select the cell you want to color. (I hope you know your cell in the code)
  6. Press Alt + F8 to open the "Macro" dialog box. ( using keystrokes)
  7. 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