0

次のコードは、期待どおりの動作をします。次のポップアップ エラーが表示されます: エラーが発生しました: メソッド offset(.

    function respondToSubmit(e) {

  var app = UiApp.getActiveApplication();
  var ss = SpreadsheetApp.openById("0AmDozcwoS3_udGVqaUdfTTRnYlVybmtydklpMkN0Mnc");
  var sheets = ss.getSheets();
  var tB3 = e.parameter.TextBox3;
  var cache = sheetCache(sheets[2].getRange("a1"));
  var values = cache.getValuesOfRange(sheets[2].getRange(22,37,113,36));

      var rowValue;
  for(var j = 0; j < values.length; ++j) {
    if (values[j][0] == tB3 ) { 
       rowValue = j;                          
      break;
     }
  }  
   Logger.log(rowValue)

  var cD = sheets[2].getRange(22,3);
  var tB1 = e.parameter.TextBox1;
  var tB2 = e.parameter.TextBox2;
  var lB1 = e.parameter.ListBox2;

  cD.offset(rowValue, 4).setValue(parseFloat(tB1));
  cD.offset(rowValue, 9).setValue(parseFloat(tB2));  
  ((tB1 == 0) && (tB2 == 0)) ? cD.offset(rowValue, 0).setValue("") :        cD.offset(rowValue, 0).setValue(tB3);
  ((tB1 == 0) && (tB2 == 0)) ? cD.offset(rowValue, 1).setValue("") : cD.offset(rowValue, 1).setValue(lB1);


  var app = UiApp.getActiveApplication();
  app.close();
  return app;  
} 

どんな提案でも大歓迎です!

4

1 に答える 1

0

CDの範囲は利用できないようです。Sheets[2] が n 個の既存のシートを参照していることを確認してください。

于 2012-07-24T10:27:19.540 に答える