![]() |
MACRO TO SELECT A PARTICULAR SHEET!
I need two macros - 1. The first macro selects among the unhidden sheets in a workbook called "A.xls", the sheet with the tabname containing the substring h3p. 2. The second macro will protect all workbooks in a folder called "Afold" with the password "avba". I would appreciate any help with this. Thanks. Jay Dean *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
MACRO TO SELECT A PARTICULAR SHEET!
Jay
The code below should get you started 1) Sub findSheet() Dim wks As Worksheet For Each wks In Workbooks("A.xls").Worksheets If InStr(1, wks.Name, "h3p") Then wks.Activate Exit Sub End If Next wks MsgBox "No sheet with name h3p found", vbOKOnly + vbExclamation End Sub 2) Sub GetProtectFilesInFolder() Dim sCurrFName As String Dim x As Integer With Application .ScreenUpdating = False .DisplayAlerts = False sCurrFName = Dir("C:\Afold\*.xls") Do While sCurrFName < "" Workbooks.Open ("C:\Afold\" & sCurrFName) Workbooks(sCurrFName).SaveAs Filename:=sCurrFName, Password:="avba" Workbooks(sCurrFName).Close sCurrFName = Dir Loop .ScreenUpdating = True .DisplayAlerts = True End With End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "jay dean" wrote in message ... I need two macros - 1. The first macro selects among the unhidden sheets in a workbook called "A.xls", the sheet with the tabname containing the substring h3p. 2. The second macro will protect all workbooks in a folder called "Afold" with the password "avba". I would appreciate any help with this. Thanks. Jay Dean *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 04:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com