+ Reply to Thread
Results 1 to 8 of 8

Need macro to move data to tabs depending on column

  1. #1
    Forum Contributor
    Join Date
    06-28-2004
    MS-Off Ver
    Home/Office 2016
    Posts
    246

    Need macro to move data to tabs depending on column

    I need to move data to separate tabs depending on column B
    And name the tab what is in column B

    Attached example
    Attached Files Attached Files
    Last edited by x65140; 11-05-2021 at 09:08 AM.

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Need macro to move data to tabs depending on column

    There are 1st row empty left for any header of data on each of these new tabs (tweak code if you do not need them):

    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    06-28-2004
    MS-Off Ver
    Home/Office 2016
    Posts
    246

    Re: Need macro to move data to tabs depending on column

    Works perfect !!!! Thanks KOKOSEK!!!!

  4. #4
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Need macro to move data to tabs depending on column

    Happy to help.
    Thanks for rep.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Need macro to move data to tabs depending on column

    Please try

    PHP Code: 
    Sub tabs()
    Dim r As Rangean&
    Application.ScreenUpdating False
    Application
    .DisplayAlerts False
    For 2 To Sheets.Count
        Sheets
    (2).Delete
    Next
    Cells(Rows.Count2).End(xlUp).Row
    For Each r In Range("B1:B" n)
        If 
    Not Evaluate("isref('" r.Value "'!a1)"Then
            Sheets
    .Add(, Sheets(Sheets.Count)).Name r.Value
            a 
    r.Parent.Evaluate(Replace("if(b1:b#=" r.Address ",row(1:#))""#"n))
            
    Application.Transpose(Filter(Application.Transpose(a), FalseFalse))
            
    Application.Index(r.Parent.Columns("a:d"), a, Array(134))
            [
    a1].Resize(Application.CountIf(r.Parent.Columns(2), r.Value), 3) = a
        End 
    If
    Next
    Application
    .ScreenUpdating True
    Application
    .DisplayAlerts True
    End Sub 
    Attached Files Attached Files

  6. #6
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Need macro to move data to tabs depending on column

    IMHO not so easy to tweak in case of change of starting details.
    Last edited by KOKOSEK; 11-05-2021 at 10:01 AM.

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need macro to move data to tabs depending on column

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  8. #8
    Forum Contributor
    Join Date
    06-28-2004
    MS-Off Ver
    Home/Office 2016
    Posts
    246

    Re: Need macro to move data to tabs depending on column

    Works GREAT as well !!!! Thanks!!!

+ 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. Copy,paste depending on data, delete, move up. VBA/Macro
    By Gorbert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2017, 12:15 PM
  2. [SOLVED] Run macro depending on what data is in column C of the selected row
    By lealea1982 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2013, 08:47 AM
  3. [SOLVED] need coding for macro to move related data from 2 different tabs into a 3rd tab
    By s4driver in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-05-2013, 02:09 AM
  4. Macro to loop through and move data to new tabs
    By tso6359 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2011, 03:05 PM
  5. Macro to move lines between tabs
    By Chemistification in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-08-2010, 08:47 AM
  6. Write macro to move data to new sheets, depending on month
    By kealisa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-24-2009, 06:51 PM
  7. seperate data from one tab to different tabs depending on the condition
    By all4excel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-11-2007, 07:05 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