如何在Excel中激活特定的工作表 [英] How to activate a specific worksheet in Excel

查看:143
本文介绍了如何在Excel中激活特定的工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要激活某个工作表。我有一个字符串变量来保存工作表的名称。

I just need to activate a certain worksheet. I have a string variable that keeps the name of the worksheet.

推荐答案

以下宏会帮助你吗?

Sub activateSheet(sheetname As String)
'activates sheet of specific name
    Worksheets(sheetname).Activate
End Sub

基本上你想使用.Activate函数。或者您可以使用.Select功能:

Basically you want to make use of the .Activate function. Or you can use the .Select function like so:

Sub activateSheet(sheetname As String)
'selects sheet of specific name
    Sheets(sheetname).Select
End Sub

这篇关于如何在Excel中激活特定的工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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