Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to go to select sheet | Excel Discussion (Misc queries) | |||
macro sheet select | Excel Discussion (Misc queries) | |||
Macro, select Sheet "Number", NOT Sheet Name | Excel Worksheet Functions | |||
Help! Macro to select all sheet from AA to ZZ | Excel Programming | |||
On Sheet select Macro | Excel Programming |