问题描述
如果工作表编号/名称是变量/变体,我如何引用公式中的下一张或上一张工作表。
我已经看到了使用vba ,有没有办法用公式或函数来做到这一点
。在任何单元格中输入等号=。这会让你进入交互模式。转到您的其他工作表并点击您想要参考的单元格。然后按回车。
引用下一张/ prevoius表。你需要一些我认为是VB代码的代码(如下所示):
$ b $ pre $ 函数PrevSheet(RCell As Range)
Dim xIndex As Long
Application.Volatile
xIndex = RCell.Worksheet.Index
如果xIndex> 1然后_
PrevSheet =工作表(xIndex - 1).Range(RCell.Address)
结束功能
然后使用
= PrevSheet(A1)
How do I reference next or previous sheet in a formula if the sheet number/name is a varible/variant.
I have seen ways to do this with vba, is there a way to do this with a formula or function
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.
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
then use
=PrevSheet(A1)
这篇关于如果图纸编号/名称是变量/变体,请参考公式中的下一张或上一张图纸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!