在多个已关闭的工作簿中取消隐藏相同的命名工作表

问题描述 投票:0回答:2

我正在寻找隐藏多个工作簿中完全相同的命名表的方法。该工作表称为ADMIN_Export。所有工作簿都在同一目录中。

我已经环顾四周,但仍无法找到完全适合的东西,一直试图在有限的编码背景下解决该问题,并且接近。这很接近:How can I run one VBA macro on all the (closed) Excel files in a folder?

所以我在用这个,但是需要实际的

Sub unhide()
   Dim myfiles, wb As Workbook, ws As Worksheet
   myfiles = Dir(Thisworkbook.Path & "\*.xlsx")
   Do While Len(myfiles) <> 0
       Debug.Print myfiles
       '~~> Should this be read-only? Or just regular open?
       Set wb = Workbooks.Open(Thisworkbook.Path & "\" & myfiles, , True)
       '~~> This is where I need help with unhiding
       wb.Close False
       Set wb = Nothing '~~> clean up
       myfiles = Dir
   Loop   
End Sub

感谢您的帮助。

excel vba
2个回答
0
投票
Sub unhide()
   Dim myfiles, wb As Workbook, ws As Worksheet
   myfiles = Dir(ThisWorkbook.Path & "\*.xlsm")
   Do While Len(myfiles) <> 0
       Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & myfiles, , True)
       Workbooks.Open myfiles
       Sheets("ADMIN_Export").Visible = True
       wb.Close True
       Set wb = Nothing
       myfiles = Dir
   Loop
End Sub

0
投票

实际上这应该起作用:

© www.soinside.com 2019 - 2024. All rights reserved.