PC Review


Reply
Thread Tools Rate Thread

Checking all sheets except 1

 
 
Patrick C. Simonds
Guest
Posts: n/a
 
      1st Dec 2008
Is there any way to amend this code so that it checks all sheets except the
sheet named Holidays


Private Sub testdelete()

'Clears Picture when changing the Year

'Application.ScreenUpdating = False

For n = 1 To Sheets.Count
With Sheets(n)
Set myPict = Nothing
On Error Resume Next
Set myPict = .Pictures("New Years Large")
On Error GoTo 0

If myPict Is Nothing Then
'not on this sheet
Else
myPict.Delete
Range("F2").Value = ""
'exit for 'stop looking on other sheets??????
End If
End With
Next n
End Sub

 
Reply With Quote
 
 
 
 
OssieMac
Guest
Posts: n/a
 
      1st Dec 2008
Hi Patrick,

Private Sub testdelete()

'Clears Picture when changing the Year

'Application.ScreenUpdating = False

For n = 1 To Sheets.Count
If Sheets(n).Name <> "Holidays" Then
With Sheets(n)
Set myPict = Nothing
On Error Resume Next
Set myPict = .Pictures("New Years Large")
On Error GoTo 0

If myPict Is Nothing Then
'not on this sheet
Else
myPict.Delete
Range("F2").Value = ""
'exit for 'stop looking on other sheets??????
End If
End With
End If
Next n
End Sub

--
Regards,

OssieMac


"Patrick C. Simonds" wrote:

> Is there any way to amend this code so that it checks all sheets except the
> sheet named Holidays
>
>
> Private Sub testdelete()
>
> 'Clears Picture when changing the Year
>
> 'Application.ScreenUpdating = False
>
> For n = 1 To Sheets.Count
> With Sheets(n)
> Set myPict = Nothing
> On Error Resume Next
> Set myPict = .Pictures("New Years Large")
> On Error GoTo 0
>
> If myPict Is Nothing Then
> 'not on this sheet
> Else
> myPict.Delete
> Range("F2").Value = ""
> 'exit for 'stop looking on other sheets??????
> End If
> End With
> Next n
> End Sub
>
>

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      1st Dec 2008
Private Sub testdelete()

'Clears Picture when changing the Year

'Application.ScreenUpdating = False

For n = 1 To Sheets.Count

With Sheets(n)
If Not .Name = "Holidays" Then 'add this line
Set myPict = Nothing
On Error Resume Next
Set myPict = .Pictures("New Years Large")
On Error GoTo 0

If myPict Is Nothing Then
'not on this sheet
Else
myPict.Delete
.Range("F2").Value = "" 'note the dot before Range
'exit for 'stop looking on other sheets??????
End If
End If 'add this line
End With
Next n
End Sub


Gord Dibben MS Excel MVP


On Mon, 1 Dec 2008 14:45:55 -0800, "Patrick C. Simonds"
<(E-Mail Removed)> wrote:

>Is there any way to amend this code so that it checks all sheets except the
>sheet named Holidays
>
>
>Private Sub testdelete()
>
>'Clears Picture when changing the Year
>
>'Application.ScreenUpdating = False
>
> For n = 1 To Sheets.Count
> With Sheets(n)
> Set myPict = Nothing
> On Error Resume Next
> Set myPict = .Pictures("New Years Large")
> On Error GoTo 0
>
> If myPict Is Nothing Then
> 'not on this sheet
> Else
> myPict.Delete
> Range("F2").Value = ""
> 'exit for 'stop looking on other sheets??????
> End If
> End With
> Next n
>End Sub


 
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
Checking numbers across various sheets Mike Microsoft Excel Worksheet Functions 2 11th Feb 2007 03:40 AM
Checking a number of sheets sphenisc Microsoft Excel Worksheet Functions 1 17th Nov 2005 06:55 PM
Checking formulas accross multiple sheets ricw Microsoft Excel Discussion 2 27th Aug 2004 09:43 PM
checking visible sheets. Scott Microsoft Excel Programming 6 1st Sep 2003 05:21 PM
checking multiple sheets. Scott Microsoft Excel Programming 7 20th Aug 2003 02:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:14 PM.