LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Looping Through Worksheets Given in a List?

Hi All,

I have the following code which is not currently working, I was wondering if
someone could spot the (probably obvious) error?

What I have is a list of worksheet names in cells range E3:H6. I want the
macro to step through these and perform actions in each worksheet. I also
want it to check if the worksheet actually exists before performing any
actions.

At the moment the macro halts at the Sheets(myCell).Select part where I'm
trying to refer to the worksheet name.

Any help would be much appreciated!
Marc



Sub Macro3()

For Each myCell In Range("E3:H6")

If myCell.Value < "" Then

Sheets(myCell).Select

.....rest of working code goes here.....

End If

Next myCell

End Sub
 
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
Looping Thru Worksheets Jay Excel Programming 2 April 12th 07 03:14 PM
Looping through Worksheets Steve Excel Programming 7 July 12th 05 07:56 PM
looping through worksheets Alex ekster Excel Programming 1 July 21st 03 03:16 AM
looping through worksheets alex Excel Programming 0 July 20th 03 06:43 PM


All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"