谢谢你的回答,现在还有问题Private Sub Workbook_BeforeClose(Cancel As Boolean)Dim sh As WorksheetFor Each sh In ActiveWorkbook.SheetsIf sh.UsedRange "" Then sh.Visible = xlSheetVeryHiddenNextActiveWorkbook.SaveSet sh = NothingEnd SubPrivate
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 17:28:06
谢谢你的回答,现在还有问题Private Sub Workbook_BeforeClose(Cancel As Boolean)Dim sh As WorksheetFor Each sh In ActiveWorkbook.SheetsIf sh.UsedRange "" Then sh.Visible = xlSheetVeryHiddenNextActiveWorkbook.SaveSet sh = NothingEnd SubPrivate
谢谢你的回答,现在还有问题
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
If sh.UsedRange "" Then sh.Visible = xlSheetVeryHidden
Next
ActiveWorkbook.Save
Set sh = Nothing
End Sub
Private Sub MyMacro()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
sh.Visible = xlSheetVisible
Next
Set sh = Nothing
End Sub
下面是一个open过程吧?为什么是mymcro(),意思是当打开工作表的时候运行宏才能打开有内容的工作表
还有你说选择右键指定宏?是在vba编辑窗口吗?还是
谢谢你的回答,现在还有问题Private Sub Workbook_BeforeClose(Cancel As Boolean)Dim sh As WorksheetFor Each sh In ActiveWorkbook.SheetsIf sh.UsedRange "" Then sh.Visible = xlSheetVeryHiddenNextActiveWorkbook.SaveSet sh = NothingEnd SubPrivate
如果是open过程的话,不用指定,就自己运行,则被隐藏的工作表总是会打开的.
如果是其他的名字,如MyMacro过程,则需要运行这个过程,才能打开被隐藏的工作表.运行宏的一个方法,就是在工作表中加一个控件(或者图片、或者自选图形等任意对象),然后选择这个对象,右键“指定宏……”,然后选择MyMacro就可以了.