如何获取当前选定的单元格/范围? [英] How to Get the currently selected cell/range?

查看:109
本文介绍了如何获取当前选定的单元格/范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有方法可以在Google表格中找到所选单元格或范围的标识(即A1符号)?

Is there a way to get the identification (i.e. A1 notation) of a selected cell or range in Google Sheets?

类似于:

=SELECTION(['Sheet1']) -> "D6"


推荐答案

你用这个函数更新单元格的时间。但它不会随着选择更改而更新。

Henrique很好地解释了为什么像这样的自定义函数不会在

This custom function will get the selection at the time you update the cell with the function. But it will not update as the selection changes.

Henrique provides a good explanation of why custom functions like this don't update in Google Apps - script to summarise data not updating.
/**
 * A function that gets the current selection, in A1Notation.
 *
 * @customfunction
 */
function SELECTED_RANGE() {
  return SpreadsheetApp.getActive().getActiveRange().getA1Notation();
}

这篇关于如何获取当前选定的单元格/范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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