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

查看:338
本文介绍了如何在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天全站免登陆