loop through selected worksheeet
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and Help » Loop through selected worksheeets with select case

Loop through selected worksheeets with select case

The UK's most regular instructor-led training courses.
Training information: excel+courses · Excel advanced · VBA courses London

resolvedResolved · Medium Priority · Version 2002/XP

Loop through selected worksheeets with select case

Jenny has attended:
Excel VBA course
Excel VBA course
Project Management course
Excel VBA Advanced course

by - delegate Jenny [2 posts] (2008 Jul 8 Tue, 12:25) replyReply

Hi

I am trying to loop through selected worksheets, using a select case statement to exclude the unwanted worksheets. I have the below code but it doesn't loop at all; it just updates the active sheet. Could you let me know where I am going wrong? "Copied Sheeet" is the name of the worksheet I want to exclude.

Thank you - Jenny.


Sub LoopWorkSheets()

Dim mySheet As Worksheet

For Each mySheet In Worksheets

Select Case mySheet.Name

Case "CopiedSheet"

Case Else

Range("A3").Font.Color = vbRed

End Select

Next mySheet

End Sub

Excel Advanced 1 day course
Version Date Location Places
available
Book Next place rate:
Card Invoice
2007 2008 Nov 27 Thu Bloomsbury 3 book now £240 £245
2003 2008 Nov 28 Fri Southwark 1 book now £235 £240
2003 2008 Dec 3 Wed Bloomsbury 0 FULL    
2003 2008 Dec 5 Fri Bayswater 5 book now £195 £205
2002/XP 2008 Dec 10 Wed Tooting 0 FULL    
2003 2008 Dec 10 Wed Bloomsbury 0 FULL    
Full Schedule: See all 98 Excel Advanced course dates.
Bookings currently available until 24th November 2009.

RE: Loop through selected worksheeets with select case

by - trainer Roy bronze contributer[28 posts] (2008 Jul 11 Fri, 12:11) replyReply

You need to say:

mySheet.Range("A3").Font.Color = vbRed

If you just say Range("A3")... you get the range on the ActiveSheet.

Althernatively, you could do mySheet.Activate within the loop.

/Roy MacLean


Related articles

· Tools From Advanced Excel Courses: Goal Seek and Solver
· Microsoft Excel Training Advanced Courses - Making Data Validation Work For You
· Excel and Inventory Management
· How to Create Better Excel Spreadsheets: Part One
· Tips to Facilitate Printing of Excel worksheets

Please browse our web site to find out more about
excel+courses and other Microsoft training courses.

Excel tip:

Move data worksheet to worksheet

To move data from one worksheet to another, highlight the data.

Select and hold down the ALT key and position the mouse on the border of the selection until the mouse pointer displays four-headed arrows.

Drag the selection down to the destination worksheet tab.

When the arrow touches the tab, Excel switches to the desired worksheet. Now drag the selection to the correct position. Let go of the mouse and then the ALT key.

To copy data from one worksheet to another, select and hold down the CTRL+ALT keystroke combination and perform the steps above.

View all Excel hints and tips

Rate this page:
3.5/5 (2 votes cast)
Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information

Training Articles

AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz