+ Reply to Thread
Results 1 to 10 of 10

Slight alteration to code to work only on prefixed sheets

  1. #1
    Registered User
    Join Date
    10-15-2012
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    81

    Slight alteration to code to work only on prefixed sheets

    Hi guys, below is a code that sorts the whole work book based on a cell reference in this case it is a cell containing day, date and time. It works very well however I would like it only to sort a range of sheets with the prefix PP* and not alter the structure of the whole work book...All PP* sheets are located between Sheets "Works" and "TEMP"

    Could anyone advise please??

    Thanks


    James



    Please Login or Register  to view this content.
    Last edited by james 35; 03-12-2013 at 06:15 AM.

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Slight alteration to code I hope :-/ lol

    Hi James
    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    CC


    If you feel really indebted please consider a donation to charity. My preferred charity is ActionAid but there are plenty of worthy alternatives.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Slight alteration to code I hope :-/ lol

    Is this solved?

    If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    10-15-2012
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Slight alteration to code I hope :-/ lol

    Half and half Arlu !

    I am adding an If worksheet named like PP* Condition ...

    I'll post the finished item up as soon as complete alond with the old one in the same thread....

    TBF I have to add a sort sheets according to depot also alonng with a tab colour change per depot and this has to be done by creating 3 lists 1 for each depot with a load of locations to be referenced so as to allocate the PP* sheet to a depot, and the, sort those sheets with the same tab colours using the macro above so I'll end up altering it again any way lol....


    It would be nice if people could make up their minds

    James

    Quote Originally Posted by arlu1201 View Post
    Is this solved?

    If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit.

  5. #5
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Slight alteration to code to work only on prefixed sheets

    HI James,
    I think this approach should work (but can't test), using the Work and TEMP bounds, rather than the sheet prefix:

    These two lines appear twice:
    Please Login or Register  to view this content.
    They specify the range of sheets to sort (from 1 to shtlast, where shtlast is = Sheets.Count)

    So to adjust the upper range, try changing the line:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    The to adjust the start range:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    (make the equivalent of this adjustment three more times)

  6. #6
    Registered User
    Join Date
    10-15-2012
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Slight alteration to code to work only on prefixed sheets

    Hey Cheeky I altered it to the below but it doesnt seem to want to run past asking me if I want to sort etc...

    Not sure whats going on with it ?

    Thanks

    James

    Please Login or Register  to view this content.
    Last edited by arlu1201; 03-13-2013 at 06:13 AM. Reason: Do not quote whole posts.

  7. #7
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Slight alteration to code to work only on prefixed sheets

    Oh, my mistake sorry, the last line of the previous should read:
    Please Login or Register  to view this content.
    not
    Please Login or Register  to view this content.
    We want it to start 1 sheet after Works and end 1 sheet before TEMP. By puttin gthe wrong sheet name in, I had it starting after TEMP and ending before TEMP!

  8. #8
    Registered User
    Join Date
    10-15-2012
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Slight alteration to code to work only on prefixed sheets

    Cheeky

    That works a treat !!! the sort parameters and over all function has changed again :-(

    But many thanks for all the assistance !!!

    this is the full code as advised
    Please Login or Register  to view this content.
    :-)
    Last edited by arlu1201; 03-13-2013 at 06:13 AM. Reason: Do not quote whole posts.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Slight alteration to code to work only on prefixed sheets

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.

  10. #10
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Slight alteration to code to work only on prefixed sheets

    ... also, welcome to the forum and glad we could help!

+ 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