快速宏 - 复制和粘贴

时间:2021-05-18 12:01:27

标签: google-sheets

想知道你是否可以帮助我,宏不是我最强的哈哈。

这是我目前拥有的...

  function PP() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('A2:D2').activate();
  var currentCell = spreadsheet.getCurrentCell();
  spreadsheet.getSelection().getNextDataRange(SpreadsheetApp.Direction.DOWN).activate();
  currentCell.activateAsCurrentCell();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('All'), true);
  spreadsheet.getRange('A2').activate();
  spreadsheet.getCurrentCell().getNextDataCell(SpreadsheetApp.Direction.DOWN).activate();
  spreadsheet.getRange('A12').activate();
  spreadsheet.getRange('Project!A2:D10').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
  spreadsheet.getRange('E2').activate();
  currentCell = spreadsheet.getCurrentCell();
  spreadsheet.getSelection().getNextDataRange(SpreadsheetApp.Direction.DOWN).activate();
  currentCell.activateAsCurrentCell();
  currentCell = spreadsheet.getCurrentCell();
  spreadsheet.getSelection().getNextDataRange(SpreadsheetApp.Direction.DOWN).activate();
  currentCell.activateAsCurrentCell();
  spreadsheet.getRange('E2').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
  spreadsheet.getRange('A1').activate();
  spreadsheet.getActiveSheet().getFilter().sort(1, false);
};

我有 2 个标签“项目”和“全部”,我想要做的是 1 - 选择“项目”选项卡中的所有内容(减少标题)(A-D 列,未知行) 2 - 复制 3 - 粘贴到“全部”的底部 4 - 将“全部”中 E 列中的公式复制到新添加的内容

如果你能帮忙,请告诉我

谢谢 标记

0 个答案:

没有答案