是否可以创建宏按钮以在Google表格中导航? [英] Is it possible to create macro buttons to navigate in Google Sheets?

查看:122
本文介绍了是否可以创建宏按钮以在Google表格中导航?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过以下链接在Google表格中创建一个数据库:

I am creating a database in Google Sheets per the link below:

数据库

我想像在excel中一样添加按钮,您可以在其中记录宏以导航或打开另一张表或执行特定功能.例如,在我的数据库中,我可以创建一个带有按钮的主页,以打开某些工作表.然后,我可以隐藏所有工作表,只有一个主页.

I would like to add buttons like you can in excel where you can record a macro to navigate or open another sheet or perform a particular function. For example in my database, I could create a home page with buttons to open certain sheets. I could then hide all of the sheets and only have a home page.

或者,也许将查询数据隐藏在其他出勤"表中的单元格C2中,并创建一个按钮以打开查询.

Or, perhaps hide the query data in cell C2 in the 'Other Attendances' sheet and create a button to open up the query.

Google表格中有这可能吗?

Is any of this possible in Google Sheets?

推荐答案

让我们创建一个转到最左侧页面的按钮.请选择右手页面之一,或按左下角的+号创建页面.

Let's create a button to go to the left hand most page. Please select one of the right hand pages or push the + sign in the lower left to create one.

这是脚本:

function gotoMostLeftPage() {
  var ss=SpreadsheetApp.getActive();
  ss.setActiveSheet(ss.getSheets()[0]);
}

现在我们需要一个按钮:

Now we need a button:

我们可以使用插入/绘图绘制绘图的图像.

We can use insert/Drawing to draw an image of our drawing.

在这种情况下,我使用的是基本形状.您可以根据需要添加文本.

In this case I'm using a basic shape. You can add text if you like.

现在只需保存并关闭.

将按钮拖动到所需位置,然后单击右上角的三个按钮. 选择分配脚本.

Drag the button to where you want it and click on the three buttons in the upper right. Select Assign script.

复制脚本名称.

将其粘贴到对话框中,然后单击确定".

Paste it into the dialog and click ok.

尝试单击该按钮,除非您已经在该按钮上,否则它将带您到最左侧的页面.

Try clicking on the button and it should take you to the left most page unless you are already there.

这篇关于是否可以创建宏按钮以在Google表格中导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆