+ Reply to Thread
Results 1 to 5 of 5

Sheet Selection Query

  1. #1
    Registered User
    Join Date
    01-12-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2003
    Posts
    18

    Sheet Selection Query

    Firstly, just wanted to say hello to everyone as i am a new member.

    I am trying to get to grips with VBA, and figured the best way was to look at elements of my working day, and see which things can be automated. I have had some success which is spurring me on to trying more.

    However, i am trying to get the code to select a particular sheet within a workbook. The problem is that the workbook we use gets updated, and as such, every update involves the creation of a new sheet.

    The work i do is always on the forth to last sheet in the workbook, and so how would i make the code activate the 4th to last sheet?

    Thanks in advance
    Last edited by Belgarath75; 01-13-2011 at 06:03 AM. Reason: solved

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Sheet Selection Query

    Put those 4 sheetnames in an array:

    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    01-12-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Sheet Selection Query

    Cheers for the reply.

    Just one question with regards to the help/solution offered, and please feel free to correct me if I have misunderstood it. Wouldnt the above code look at the same sheet numbers everytime?? What I am trying to get round is the fact that a group of people use one spreedsheet, and whenever updates are made, a new sheet is added to the workbook, and once completed, it is place forth sheet from the end. So this week the sheet in question might be sheet10, but next week, will be sheet11, week after will be sheet12.......

    As i say, i am still new to the basics of VBA so i may be misunderstanding this.

    Thanks again

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Sheet Selection Query

    The code will always select the same sheets (based on the sheetnames, not numbers)

    If you want to select the 4 most recent sheets:.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-12-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Sheet Selection Query

    Thanks for the respose.

    I shall mark it as solved and reopen if i have further problems

+ 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