Set a selection of cells to a certain color by clicking a button

945 views Asked by At

I want to colorize selected fields from user with a Office Script. Is that possible?

Robert

EDIT:

  1. Select a number of cells, depending on which the user chooses
  2. Press a Button (Make Cell Green)
  3. Colorize the Cells which were selected.
1

There are 1 answers

0
Petra On

You can use workbook.getSelectedRange() to get the user selected range in the workbook.

function main(workbook: ExcelScript.Workbook) {
    workbook.getSelectedRange().getFormat().getFill().setColor("4472C4");

}