+ Reply to Thread
Results 1 to 31 of 31

Original macro altered to work only on Prefixed WB no longer working?? Advive please ??

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

    Original macro altered to work only on Prefixed WB no longer working?? Advive please ??

    Hi guys

    Here is the original macro that works to add sheets to all open WB -

    Please Login or Register  to view this content.
    Ive tried to ammend it to work only on WorkBoos with the Prefix BRM in the name...

    as below

    Please Login or Register  to view this content.
    However it bugs out and simply stops at the underlined and I'm struggling to figure out why??

    Can anyone advise??

    Many Thanks

    James
    Last edited by james 35; 04-29-2013 at 06:52 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Perhaps.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Try replacing

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    Elegant Simplicity............. Not Always

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Quote Originally Posted by Norie View Post
    Perhaps.
    Please Login or Register  to view this content.
    No joy I'm affraid Norie, have I forgot anything basic here??

    James

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Quote Originally Posted by AndyLitch View Post
    Try replacing

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    Tried that MR litch and still debugging on the same line of code :-(

    James


    Please Login or Register  to view this content.

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    perhaps
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Thanks Joseph!

    I'm no longer at my desk so will give it a try tomorrow and get back to you with the result !!

    Many thanks

    James


    Quote Originally Posted by JosephP View Post
    perhaps
    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Slacker

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Andy I have been called worse lol !!!

    Sorry not got back to you guys sooner just been really busy... But Joseph that worked a treat thank you !!! And thanks Andy also !!

    If I could be cheeky is there a way of getting that working macro to delete the first 4 sheets from each Wb before adding the additional sheets its designed to ??

    Or should I start another thread for that??

    Thanks again guys

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    will the target workbooks have more than 4 sheets to start with?

  11. #11
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    if they will
    Please Login or Register  to view this content.

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Quote Originally Posted by JosephP View Post
    will the target workbooks have more than 4 sheets to start with?


    Yes Joseph they have about 20ish sheets... from sheets 5 onwards they are generic for an access point..

    Sheets one to 4 contain the relevant data that alters each time they are utilised...

    hence its only ever the first 4 sheets affected pal..

    James

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Quote Originally Posted by JosephP View Post
    if they will
    Please Login or Register  to view this content.


    Aha that works well joseph however I have just noticed that some people have been saving the packs with just the generic data ie the first 4 sheets missing lol could i Specify the sheets by name ie

    Please Login or Register  to view this content.
    So as to delete the specific sheets if they exist and if not just add the newer ones ??

    Thanks

    James

  14. #14
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Please Login or Register  to view this content.
    as long as either all or none of the sheets exist. if only some might exist you'll have to loop through the array
    Please Login or Register  to view this content.

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Quote Originally Posted by JosephP View Post
    Please Login or Register  to view this content.
    as long as either all or none of the sheets exist. if only some might exist you'll have to loop through the array
    Please Login or Register  to view this content.
    Brilliant Joseph Thankyou!!!

    If I name them "Cover Sheet*" etc. would that delete Say Cover Sheet and also Cover Sheet 1 If some Numpty had duplicated them? I would I have to incorperate the Name Like option as with the BRM pack prefix?

    Thanks

    James

  16. #16
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    you'd have to use "like" again

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Quote Originally Posted by JosephP View Post
    you'd have to use "like" again
    Like this?

    Please Login or Register  to view this content.

  18. #18
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    more like this
    Please Login or Register  to view this content.

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Damn it just started to bug out on the Line below Error message is Runtime 1004 copy method of worksheet class failed ??

    Any Idea's ?

    Please Login or Register  to view this content.

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    I shut excel completely again and its working fine again now though the named like coding above doesnt work it debugs at the underlined??



    Please Login or Register  to view this content.
    Thanks

    James

  21. #21
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    what's the error?

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    runtime error 2147221080 (800401a8)
    automation error Joseph :-/

    lol nightmare !!

    james :-)

  23. #23
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    oh-I'm a dumbass
    Please Login or Register  to view this content.

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Quote Originally Posted by JosephP View Post
    oh-I'm a dumbass
    Please Login or Register  to view this content.
    LOL

    Ill have to test it tomoz now as im just about to leave

    But many thanks for all the help :-)

    James

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    Hey joseph P

    Finally managed to test it and i'm getting the Error "End if without Block if"???

    Not a clue lol

    James

    Please Login or Register  to view this content.

  26. #26
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    you seem to have deleted a bunch of code lines
    Please Login or Register  to view this content.

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    I honestly dont see it lol




    Quote Originally Posted by JosephP View Post
    you seem to have deleted a bunch of code lines
    Please Login or Register  to view this content.

  28. #28
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    what you posted was missing the
    Please Login or Register  to view this content.
    lines

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    How the hell I managed to do that is beyond me lol I must still be hungover !!!

    Thanks For all the help Joseph ! works a treat



    Quote Originally Posted by JosephP View Post
    what you posted was missing the
    Please Login or Register  to view this content.
    lines

  30. #30
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    you're welcome
    hope the day gets better ;-)

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

    Re: Original macro altered to work only on Prefixed WB no longer working?? Advive please ?

    you and me both !!!

+ 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