PC Review


Reply
Thread Tools Rate Thread

ammend to exlude sheet(s)

 
 
J.W. Aldridge
Guest
Posts: n/a
 
      23rd Feb 2010

Need to exlude (add to code) sheets "S2" and "S4" sheets along with
"S3".


Option Explicit


Sub testme3()


Dim mysheets
Dim wks As Worksheet
Dim firstselected As Boolean


Set mysheets = ActiveWindow.SelectedSheets


firstselected = False
For Each wks In mysheets
If ucase(wks.Name) = "S3" Then
'do nothing
ElseIf Not firstselected Then
wks.Select
firstselected = True
Else
wks.Select Replace:=False
End If
Next wks


End Sub


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      23rd Feb 2010
Option Explicit
Sub testme3()

Dim mySheets as Object
Dim wks As Worksheet
Dim FirstSelected As Boolean

Set mySheets = ActiveWindow.SelectedSheets

FirstSelected = False
For Each wks In mySheets
Select Case UCase(wks.Name)
Case Is = "S2", "S3", "S4"
'do nothing
Case Else
If Not FirstSelected Then
wks.Select
FirstSelected = True
Else
wks.Select Replace:=False
End If
End Select
Next wks

End Sub


"J.W. Aldridge" wrote:
>
> Need to exlude (add to code) sheets "S2" and "S4" sheets along with
> "S3".
>
> Option Explicit
>
> Sub testme3()
>
> Dim mysheets
> Dim wks As Worksheet
> Dim firstselected As Boolean
>
> Set mysheets = ActiveWindow.SelectedSheets
>
> firstselected = False
> For Each wks In mysheets
> If ucase(wks.Name) = "S3" Then
> 'do nothing
> ElseIf Not firstselected Then
> wks.Select
> firstselected = True
> Else
> wks.Select Replace:=False
> End If
> Next wks
>
> End Sub


--

Dave Peterson
 
Reply With Quote
 
J.W. Aldridge
Guest
Posts: n/a
 
      23rd Feb 2010
thanx!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Listbox to Ammend Database john@hibbitts.co.uk Microsoft Access 0 28th Feb 2008 12:25 PM
Ammend Trusted Locations John Microsoft Access 2 15th Feb 2008 01:45 PM
Please ammend Formula =?Utf-8?B?QnVyaGFuIFVkZGlu?= Microsoft Excel Programming 2 27th May 2007 11:40 AM
need to ammend a formula =?Utf-8?B?Um9iYjI3?= Microsoft Excel Worksheet Functions 2 5th Aug 2006 08:04 AM
Import data file but exlude information I already have in sheet? =?Utf-8?B?VG9tIFI=?= Microsoft Excel Misc 1 3rd May 2005 12:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:23 AM.