+ Reply to Thread
Results 1 to 2 of 2

Cycling through sheet names in VBA

  1. #1
    Registered User
    Join Date
    01-14-2007
    Posts
    1

    Cycling through sheet names in VBA

    I am using a FOR loop to go through up to 20 sheets, activating each so that I can print certain ranges on them.

    I am using the VBA sheet names (Sheet1,Sheet2,Sheet3, etc) rather than the names on the tabs, because the tabs are named for company tickers. I would like to be able to write something like this:

    for x=1 to 20
    Sheet&x.activate
    [Print sequence here]
    next x

    The problem is that Sheet&x does not work. In user forms, if I want to go through Checkbox1 to Checkbox20, and check them all, I can use Controls, e.g.:

    for x to 20
    Controls("Checkbox"&x).value=TRUE
    next x

    So I am looking for a similar thing like Controls but for sheets.

    Any ideas?

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    VBA code would be ...
    Please Login or Register  to view this content.
    HTH
    Carim


    Top Excel Links

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1