使用Excel VBA获取工作表名称 [英] Get a worksheet name using Excel VBA
本文介绍了使用Excel VBA获取工作表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在可以返回当前工作表的 Excel
中创建一个用户定义的
函数。我可以使用
I would like to create an user-defined
function in Excel
that can return the current worksheet. I could use the
sheetname = ActiveSheet.Name
但是问题在于它的工作原理,突然之间它开始获得不同的表名称。例如,而不是 SHEET我爱你
它返回 SHEET我恨你
。
But the problem with this is, it works and suddenly it starts to get different sheet name. For example, instead of SHEET I LOVE YOU
it returns SHEET I HATE YOU
.
有没有办法修复这个 - 或者可能是因为我认为它不能是静态的,但是变化?
Is there anyway to fix this - or it might possible because I think it can not be static but varies?
推荐答案
Function MySheet()
MySheet = Application.Caller.Worksheet.Name
End Function
这应该是您要查找的功能
This should be the function you are looking for
这篇关于使用Excel VBA获取工作表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文