Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to go to select sheet Kevin Excel Discussion (Misc queries) 2 December 18th 07 02:28 AM
macro sheet select Dave K Excel Discussion (Misc queries) 2 October 21st 05 10:08 PM
Macro, select Sheet "Number", NOT Sheet Name DAA Excel Worksheet Functions 4 November 30th 04 05:29 PM
Help! Macro to select all sheet from AA to ZZ Don Guillett[_4_] Excel Programming 4 May 28th 04 02:47 AM
On Sheet select Macro Colin G Eastwood Excel Programming 3 January 21st 04 05:22 PM


All times are GMT +1. The time now is 06:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"