+ Reply to Thread
Results 1 to 23 of 23

Wildcard for Different Sheet names

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Wildcard for Different Sheet names

    I have a macro that I have to run on 6 different worksheets. Each sheet has a different name. Rather than having to edit the macro to coorespond with the specific sheet that I am running, is there a way to use a wildcard for the sheet name that will allow it to run?

    Here is the portion of the macro that has to be edited each time to the different file name. ("FW CONVERSION")


    Please Login or Register  to view this content.
    Last edited by Leith Ross; 01-13-2014 at 01:06 PM. Reason: Fixed Code tags

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Wildcard for Different Sheet names

    Please use [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags when posting codes. See rule #3 of Forum rules.


    If you want people to suggest or give you a solution maybe at least list out the names of your worksheets?
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    Sorry about that.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Wildcard for Different Sheet names

    No need to be sorry, it's fine, just edit your post and add in the tags.

    And as for your request, list out all the worksheet names that you have. No one can provide a "wild card" match just by looking at one worksheet name.

  5. #5
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    My different worksheet names are as follows

    FW CONVERSION
    GC CONVERSION
    KC CONVERSION
    SP CONVERSION
    OK CONVERSION
    NV CONVERSION
    ME CONVERSION

  6. #6
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Wildcard for Different Sheet names

    You still haven't edit your first post.


    Try this
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    I am getting a next without For error when using your fix. Here is the entire macro.

    Please Login or Register  to view this content.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Wildcard for Different Sheet names

    Is this the code you want to run on all 7 sheets?
    If posting code please use code tags, see here.

  9. #9
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    Yes it is. The worksheet name is that only difference between them

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Wildcard for Different Sheet names

    What about all the code before the sort code which has no worksheet reference?

  11. #11
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    This was the entire macro code. It runs perfectly right now, I only have to change the worksheet name each time before I execute it. Not sure what you are referencing.

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Wildcard for Different Sheet names

    All of this code here where no worksheet is referred to.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    I apolgize. But I don't know how to answer that. I have copied all of the code that is the macro. I wish I could answer the question because I really need to find a solution for this. Thanks anyway.

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Wildcard for Different Sheet names

    Is the code in post #12 to be applied to all 7 sheets?

  15. #15
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    Yes it is applied to all 7 sheets.

  16. #16
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    Yes it is applied to all 7 sheets.

  17. #17
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Wildcard for Different Sheet names

    Sorry a small mistake, had 2 "next"'s.

    Please Login or Register  to view this content.

  18. #18
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Wildcard for Different Sheet names

    millz, you need to qualify your range references.
    Entia non sunt multiplicanda sine necessitate

  19. #19
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Wildcard for Different Sheet names

    Quote Originally Posted by shg View Post
    millz, you need to qualify your range references.
    Right, totally missed the Ranges.

    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    03-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    491

    Re: Wildcard for Different Sheet names

    Please Login or Register  to view this content.
    is this the "wildcard" part of the code? I never seen this before.
    what's the protocol for wild card?

  21. #21
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Wildcard for Different Sheet names

    It's pretty well explained in VBE Help for Like operator

  22. #22
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    Thanks for the response, but where in the code does this need to be inserted. Sorry for my ignorance on this, but I guess that's way I am here in the first place.

  23. #23
    Registered User
    Join Date
    03-28-2012
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Wildcard for Different Sheet names

    Never mind my last post! I figured it out. It works perfectly, thanks so much for all your help, it is appreciated.

+ 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] Create an Array which has Sheet Names excluding a Few Sheet Names to be used in a MACRO
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-29-2013, 03:24 PM
  2. Replies: 2
    Last Post: 01-24-2013, 04:56 PM
  3. Create a Formula That Uses a Wildcard for Multiple Workbook Names
    By squirl1899 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-04-2012, 03:34 PM
  4. Getting a list of Sheet Names by excluding certain Sheet Names instantenously..
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-09-2012, 12:16 PM
  5. Vlookup and sheet wildcard search
    By killar65 in forum Excel General
    Replies: 1
    Last Post: 08-25-2010, 08:32 AM

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