+ Reply to Thread
Results 1 to 3 of 3

how to code "if tab name starts with a string, then move these tabs to a new workbook"

  1. #1
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    how to code "if tab name starts with a string, then move these tabs to a new workbook"

    Hello,

    I have a workbook with over 60 tabs, example of their names:

    111100
    111100A
    111100Detail
    111100B
    213100
    213100Detail
    213100A
    131460
    131460Detail
    312504
    312504Detail
    312504Ele
    312504Wat
    312504Gas

    so they all start with a 6-digit code and they all have a code+Detail tab, but other than that, some can have more tabs and others don't. I have the list of the 6-digit on Sheet1 such as:

    111100
    213100
    312504

    what I need is for the codes to copy tabs starting with each of these values, i.e.

    111100
    111100A
    111100Detail
    111100B
    will be copied to a new workbook

    213100
    213100Detail
    213100A
    will be copied to a new workbook

    312504
    312504Detail
    312504Ele
    312504Wat
    312504Gas
    will be copied to a new workbook

    131460 will be copied at all because it is not on the list.

    I don't know how to code this line: "if the tab name start with the cell value, then copy it", I'm not sure how to use * in this case. can someone please show me how to code this part?

    thanks so much

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: how to code "if tab name starts with a string, then move these tabs to a new workbook"

    Quote Originally Posted by lynnsong986 View Post
    I don't know how to code this line: "if the tab name start with the cell value, then copy it", I'm not sure how to use * in this case. can someone please show me how to code this part?
    Try something like this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    Re: how to code "if tab name starts with a string, then move these tabs to a new workbook"

    oh the like operator...thanks so much!!

+ 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] Macro to extract specific number from string starts with "18"
    By rajuuuuu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2018, 08:21 AM
  2. [SOLVED] Code "suddenly" starts giving me error 6 overflow
    By jayherring86 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-20-2016, 07:38 AM
  3. How to use InStr function to search for a text that starts with "CTF" and ends with "."?
    By yoursamrit2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2014, 06:52 PM
  4. Replies: 1
    Last Post: 08-15-2014, 06:00 AM
  5. Replies: 1
    Last Post: 08-10-2014, 01:22 PM
  6. [SOLVED] vba code to replace the column names for those column name "Proposal that starts with "1."
    By mvneema in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-31-2014, 01:21 PM
  7. [SOLVED] How to "Move but don`t size with cells" objects on several tabs?
    By faceCook in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 12-19-2013, 10:56 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