Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Checking all sheets except 1

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Checking all sheets except 1

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Checking all sheets except 1

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"
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
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
Checking numbers across various sheets Mike Excel Worksheet Functions 2 February 11th 07 03:40 AM
Checking names on correct line across sheets Ali Excel Worksheet Functions 5 January 17th 06 07:24 AM
Checking a number of sheets sphenisc Excel Worksheet Functions 1 November 17th 05 06:55 PM
checking visible sheets. Scott Excel Programming 6 September 1st 03 05:21 PM
checking multiple sheets. Scott Excel Programming 7 August 20th 03 02:21 AM


All times are GMT +1. The time now is 12:05 AM.

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"