Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exclude some worksheets when using UsrSht function


Hello -
I am using the following script to set print areas and run a macro fo
many worksheets at once. Works great, except that I really need t
exclude about 5 worksheets from a 100 sheet workbook when using th
function.
Any suggestions would be appreciated!

Sub SetRange()
For Each UsrSht In ActiveWorkbook.Worksheets
UsrSht.PageSetup.PrintArea = "$A$1:$F$30"
Next UsrSht
End Sub

thanks,
Annabe

--
annabe
-----------------------------------------------------------------------
annabel's Profile: http://www.excelforum.com/member.php...fo&userid=2652
View this thread: http://www.excelforum.com/showthread.php?threadid=44141

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Exclude some worksheets when using UsrSht function

Sub SetRange()
Dim UsrSht as Worksheet
Dim sName as String
For Each UsrSht In ActiveWorkbook.Worksheets
sName = lcase(UsrSht.Name)
if sName < "sheet1" and sName < "sheet5" and _
sName < "sheet10" and sName < "sheet15" and _
sName < "summary" then
UsrSht.PageSetup.PrintArea = "$A$1:$F$30"
end if
Next UsrSht
End Sub

make sure the sheet names you check against are lower case as shown.

--
Regards,
Tom Ogilvy


"annabel" wrote in
message ...

Hello -
I am using the following script to set print areas and run a macro for
many worksheets at once. Works great, except that I really need to
exclude about 5 worksheets from a 100 sheet workbook when using the
function.
Any suggestions would be appreciated!

Sub SetRange()
For Each UsrSht In ActiveWorkbook.Worksheets
UsrSht.PageSetup.PrintArea = "$A$1:$F$30"
Next UsrSht
End Sub

thanks,
Annabel


--
annabel
------------------------------------------------------------------------
annabel's Profile:

http://www.excelforum.com/member.php...o&userid=26520
View this thread: http://www.excelforum.com/showthread...hreadid=441414



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exclude some worksheets when using UsrSht function


Thank you very much - that is exactly what I need!!
I appreciate your time and knowledge

--
annabe
-----------------------------------------------------------------------
annabel's Profile: http://www.excelforum.com/member.php...fo&userid=2652
View this thread: http://www.excelforum.com/showthread.php?threadid=44141

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
minimum function but want to exclude zero kinsey Excel Discussion (Misc queries) 3 November 18th 10 02:46 PM
Average Function but exclude info Linda RQ[_2_] New Users to Excel 4 April 16th 10 09:17 PM
Exclude worksheets from workbook print cabana_boy via OfficeKB.com Excel Discussion (Misc queries) 4 December 3rd 09 06:44 PM
How do I exclude the HIGH and LOW values in the =AVERAGE function DeWayne Excel Worksheet Functions 2 September 17th 09 11:37 PM
How to exclude all letter using find and replace function? Paul Mak Excel Programming 0 May 5th 05 07:25 PM


All times are GMT +1. The time now is 08:37 PM.

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

About Us

"It's about Microsoft Excel"