0

colA に名前のリストを含む単純なスプレッドシートが Google ドライブ スプレッドシートにあります。ColB から ColJ は、空白のセルを埋めます。

ColJ を介して ColB にデータが入力されていないときに、ColA のセルの背景色を変更したいのですが、これを行う方法がわかりません。

4

2 に答える 2

1

条件付き書式でこの機能が提供されると思われるかもしれませんが、他のセルを参照することはできません。(エクセルとは違います。)

これは、ジョブを実行するスクリプトです。(Google Apps Script を初めて使用する場合は、この概要をお読みください)。

/**
 * The onEdit() function, when defined, is automatically invoked whenever the
 * spreadsheet is edited. (Not every change is an "edit".)
 *
 * If all of the "fill in the blanks" columns are empty, set the
 * background color of the name column in that row.
 */
function onEdit(event) {
  var row = event.range.getRow();
  var sheet = event.range.getSheet();
  var cellA = sheet.getRange(row,1);
  // Get the range of cells B-J that make up the "fill in the blanks" range...
  var fillInTheBlanks = sheet.getRange(row, 2, 1, 9)
                             .getValues()[0]  // ... get values in 0-th row
                             .join('');       // ... and join into one string

  // Check that string - if it is empty, the range was blank,
  // and we should set the background color to, say, yellow.
  if (fillInTheBlanks.length == 0) {
    cellA.setBackground("yellow");
  }
  // On the other hand, if the string was NOT blank, there is something
  // in the "fill in the blanks" range, so we will clear the background.
  else {
    cellA.setBackground("white");
  }
}

/**
 * The onOpen() function, when defined, is automatically invoked whenever the
 * spreadsheet is opened.
 *
 * Iterates through all rows in spreadsheet, faking onEdit triggers, as if
 * each name has been edited.
 */
function onOpen() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var lastRow = sheet.getLastRow();
  for (var row=1; row <= lastRow; row++) {
    onEdit({range:sheet.getRange('A'+row)});
  }
};
于 2013-05-29T03:01:47.687 に答える
0

ColumnA から書式設定をクリアし、ColumnA と書式を選択し、条件付き書式設定...、次の場合にセルを書式設定...カスタム式はand:

=and(A1<>"",counta(B1:J1)=0)

次に、選択した塗りつぶしを選択してDone.

于 2017-06-06T02:25:35.187 に答える