[英]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.