如果工作表编号/名称是变量/变体,请参考公式中的下一张或上一张工作表 [英] Reference next or previous sheet in a formula if the sheet number/name is a varible/variant

查看:20
本文介绍了如果工作表编号/名称是变量/变体,请参考公式中的下一张或上一张工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果工作表编号/名称是变量/变体,我如何引用公式中的下一张或上一张工作表.

How do I reference next or previous sheet in a formula if the sheet number/name is a varible/variant.

我已经看到了用 vba 做到这一点的方法,有没有办法用公式或函数来做到这一点

I have seen ways to do this with vba, is there a way to do this with a formula or function

推荐答案

  1. 在 Excel 中.在任何单元格中输入等号=".这将使您进入交互模式.

  1. In Excel. Enter an equals sign "=" in any cell. This will put you into interactive mode.

导航到其他工作表并单击要引用的单元格.然后按回车.

Navigate to your other sheet and click the cell you want to reference. Then hit enter.

返回上一个工作表并编辑您开始的单元格,您应该会看到要使用的公式.

Go back to the previous sheet and edit the cell you started in and you should see the formula to use.

引用下一个/上一个工作表 (参见此处的示例).我认为你需要一些 VB 代码(类似的东西):

To reference the next/prevoius sheet (See example here). You'll need some VB code I think (something along the lines of):

Function PrevSheet(RCell As Range)
    Dim xIndex As Long
    Application.Volatile
    xIndex = RCell.Worksheet.Index
    If xIndex > 1 Then _
        PrevSheet = Worksheets(xIndex - 1).Range(RCell.Address)
End Function

然后使用

=PrevSheet(A1)

这篇关于如果工作表编号/名称是变量/变体,请参考公式中的下一张或上一张工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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