有人知道如何从工作表上的VBA代码中获取工作表名称吗?例如: Sheet12上的代码将返回sheet12的名称,Sheet11上的相同代码将返回sheet11的名称?谢谢。
发布于 2013-10-01 21:38:06
您可以参考以下两个属性:
.Name
:这是您可以在Excel UI.CodeName
:中看到的工作表的名称这是您在VB编辑器中看到的工作表的名称
示例:
MsgBox "Name of the current sheet in Excel: " & ActiveSheet.Name & vbCrLf & _
"Name of the sheet in VB editor: " & ActiveSheet.CodeName
发布于 2013-10-01 21:36:31
这将给出激活的任何工作表的名称:
Sub dural()
MsgBox ActiveSheet.Name
End Sub
https://stackoverflow.com/questions/19117583
复制相似问题