简体   繁体   English

如何制作一个按钮以跳到Google Spreadsheet中另一个工作表中的特定单元格?

[英]How to make a button to jump to a specific cell in another sheet in Google Spreadsheet?

I have a Google spreadsheet with many sheets and a table of contents. 我有一个包含许多工作表和一个目录的Google电子表格。 Is there some way to create a button in the main sheet so that with a click one can go directly to the cell in another sheet? 有什么方法可以在主表中创建一个按钮,以便单击即可直接转到另一张表中的单元格?

I figured out the way to make button and assigned the script to the button. 我想出了制作按钮的方法,并将脚本分配给了按钮。

I modified a script to become like this, but I have problem on the last line, what should I do? 我将脚本修改为这样,但是在最后一行遇到了问题,该怎么办?

function goToSheet2b() {
  goToSheet("8601-10!N1");
}

function goToSheet(sheetName) {
  var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);
  SpreadsheetApp.setActiveSheet(sheet);
}

PS: 8601-10 is the name of the other sheet I need to go to. PS:8601-10是我需要去的另一张纸的名称。

Thank you for your help. 谢谢您的帮助。

You can't have the cell reference in the sheet name. 工作表名称中不能包含单元格引用。 You have to send them as separate variables. 您必须将它们作为单独的变量发送。

function goToSheet2b() {
  // 1 = row 1, 14 = column 14 = N
  goToSheet("8601-10", 1, 14);
}

function goToSheet(sheetName, row, col) {
  var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);
  SpreadsheetApp.setActiveSheet(sheet);
  var range = sheet.getRange(row, col)
  SpreadsheetApp.setActiveRange(range);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 添加按钮以更新Google Spreadsheet。 递增单元格并用当前日期更新另一个单元格 - Add button to update Google Spreadsheet. Increment cell and update another cell with current date 谷歌电子表格 - 制作按钮,按下时将数据添加到另一个工作表中的单元格中 - Google spreadsheet - Making buttons that add data into cells into another sheet when pressed 在Google电子表格中放置一个“开始”按钮 - Put a “Start” button in Google spreadsheet 如何在 VBA 中以编程方式在某些工作表单元格数据旁边添加一个按钮? - How to add a button programmatically in VBA next to some sheet cell data? 如何在 Google 表格中创建一个按钮来切换目标单元格中的值 1 和 0? - How can I make a button within Google Sheets that toggles the values 1 and 0 in a destination cell? 我如何从一个页面制作一个按钮,以自动触发另一个页面的特定按钮? - How i can make a button ,from a page , to automatically trigger a specific button from another page? Google电子表格按钮上的时间戳 - time stamp on a button google spreadsheet 如何从特定单元格中删除按钮? - How to delete button from a specific cell? 如何使用按钮将表格导出为 Google 应用制作工具中的 Google 表格 - How to export a table as google sheet in Google app maker using a button 使玩家跳至LIBGDX中的特定高度 - Make a player jump to specific height in LIBGDX
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM