+ Reply to Thread
Results 1 to 3 of 3

Worksheet Numbers and order

  1. #1
    Forum Contributor
    Join Date
    01-21-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    258

    Worksheet Numbers and order

    Good afternoon all,

    I have a number of macros in a workbook that create/update/delete sheets. Some are hidden, some very hidden some are open to see.

    Sheets 1 to 5 in my excel objects in the VBA project are all sheets I can ignore from most of these macros so generally when I'm trying to loop through the other sheets to update them I'm using a bit of code to count the number of sheets then using something like
    Please Login or Register  to view this content.
    Even though when I'm creating (and deleting) sheets I make sure it adds them after the existing worksheets it doesn't seem to keep the order of the original five sheets. It's kicking up all sorts of problems with my subs. Is there any way that I can lock these original 5 sheets as sheets 1 to 5 even if they're hidden or veryhidden?

    any help or advise why this happens would be greatly appreciated.

    Kind Regards,

    R

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Worksheet Numbers and order

    Hi R,

    In my experience there are 3 basic methods to access a Worksheet:
    a. Numeric order (your method)
    b. Code Name (Internal Name assigned by Excel - Difficult for User to Change)
    c. Sheet Name (External Name - Easy for User to Change).

    My personal preference is c. A large number of professional programmers swear by method b. I usually swear at it. If you choose method b. or c. you can use a 'nested if' or 'select case' construction to exclude specific sheets or to include specific sheets.

    Please Login or Register  to view this content.
    Lewis

  3. #3
    Forum Contributor
    Join Date
    01-21-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    258

    Re: Worksheet Numbers and order

    Hi LJM, thanks for the info. I think method b is exactly what I'm looking for, something that will stay constant.

    Cheers friend!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Numbers Are Out Of Order
    By Sammy1962 in forum Excel General
    Replies: 4
    Last Post: 04-03-2015, 11:32 PM
  2. [SOLVED] re-numbering a list of numbers based on another list of numbers to get a sequential order
    By ryan.wherry in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-10-2014, 03:27 PM
  3. [SOLVED] How do you apply the int() in VBA in order to convert numbers stored as text to numbers
    By djaurit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 02:57 PM
  4. Order numbers
    By raw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2007, 08:35 AM
  5. Replies: 1
    Last Post: 07-11-2006, 01:35 PM

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