excel - 从第一行中选定行的第二行字段中获取值
问题描述
I am looking to obtain the corresponding value from the 1st-row field in a pivot table when a value in the 2nd-row field is selected.
我有一个两行数据透视表,第一行是工作表名称,第二行是单元格引用。
我计划使用这些信息来创建超链接操作。What I am struggling to get however is the corresponding sheet name from row1 when a cell reference in row2 is selected.
在上面的示例表中,我可以在选中单元格引用(例如 A$3$)时捕获它,但我不知道如何获取工作表数据(在此示例中为 Sheet3)
解决方案
也许不是最好的答案,但对我来说,足够优雅:
IIf(IsEmpty(Target.Offset(0, -1)), Target.Offset(0, -1).End(xlUp).Value, Target.Offset(0, -1).Value)
这将检查上一列中的单元格是否有值,如果有则返回,否则将返回其正上方的第一个非空单元格中的值。
推荐阅读
- c++ - 有没有办法结合这两个正则表达式?
- c# - 从字符串数组验证电子邮件地址
- python - 在python中使用“适应屏幕”参数更改macOS背景图片
- java - 在运行时执行好的方法
- javascript - 在 React 中映射多个数组
- swiftui - 为什么在我什至在 SwiftUI 上单击它之前调用 NavigationLink
- mysql - 如何计算 MySQL 递归 CTE 中的 Running Total?
- html - HTML 元素出现在页面边缘之外
- python - 调试特定的子进程
- python - scikit-learn 0.24.1 和 scikit-optimize 0.8.1 之间的不兼容问题