Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Skip Worksheets With Looping Coding

Hey all,
I have some coding that loops through a workbook and puts the tab name in
cell B5 of multiple worksheets (around 265 or so this month). This has worked
very well until this month in that I have a protected worksheet, not
protected by me so I don't have the password, that causes Excel to error out
when it comes to it. How can I get it to skip that worksheet? Here's the
coding I've been using.

Sub TabNameInCellB5()

Dim iSheet As Long
Application.ScreenUpdating = False
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
Worksheets(iSheet).Cells(5, 2) = "'" & Worksheets(iSheet).Name
Next iSheet
Application.ScreenUpdating = True

End Sub

Any help would be very appreciated.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Skip Worksheets With Looping Coding

Sub TabNameInCellB5()

Dim iSheet As Long
Application.ScreenUpdating = False
On error resume next 'ignore errors
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
Worksheets(iSheet).Cells(5, 2) = "'" & Worksheets(iSheet).Name
Next iSheet
on error goto 0 'resume checking for errors
Application.ScreenUpdating = True

End Sub

--
HTH...

Jim Thomlinson


"Joe_Hunt via OfficeKB.com" wrote:

Hey all,
I have some coding that loops through a workbook and puts the tab name in
cell B5 of multiple worksheets (around 265 or so this month). This has worked
very well until this month in that I have a protected worksheet, not
protected by me so I don't have the password, that causes Excel to error out
when it comes to it. How can I get it to skip that worksheet? Here's the
coding I've been using.

Sub TabNameInCellB5()

Dim iSheet As Long
Application.ScreenUpdating = False
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
Worksheets(iSheet).Cells(5, 2) = "'" & Worksheets(iSheet).Name
Next iSheet
Application.ScreenUpdating = True

End Sub

Any help would be very appreciated.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Skip Worksheets With Looping Coding

Thanks!

Jim Thomlinson wrote:
Sub TabNameInCellB5()

Dim iSheet As Long
Application.ScreenUpdating = False
On error resume next 'ignore errors
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
Worksheets(iSheet).Cells(5, 2) = "'" & Worksheets(iSheet).Name
Next iSheet
on error goto 0 'resume checking for errors
Application.ScreenUpdating = True

End Sub

Hey all,
I have some coding that loops through a workbook and puts the tab name in

[quoted text clipped - 16 lines]

Any help would be very appreciated.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1

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
Looping through worksheets Hermeticia Excel Programming 3 April 10th 08 05:01 AM
Skip or Ignore Missing Worksheets abba92 Excel Programming 1 October 23rd 07 06:38 PM
Looping Thru Worksheets Jay Excel Programming 2 April 12th 07 03:14 PM
Worksheets looping. Bob Phillips Excel Programming 0 December 6th 06 10:38 AM
coding worksheets for undesired selections Ed[_21_] Excel Programming 3 September 30th 04 05:01 PM


All times are GMT +1. The time now is 07:50 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"