+ Reply to Thread
Results 1 to 5 of 5

Split worksheet into multiple worksheets with headers

  1. #1
    Registered User
    Join Date
    07-29-2018
    Location
    NZ
    MS-Off Ver
    2016
    Posts
    2

    Split worksheet into multiple worksheets with headers

    Hi,

    I have a worksheet that is derived from a csv file export, the sheet has several sections that are start with a header row beginning with a specific value in the first cell of the row. For example a section could look like this:
    :AlarmGrp Group Comment EventLogged
    Kansas Kansas City Alarm Group for Kansas City Yes
    The number of rows between that section and the next can vary, however the next section will start similarly:
    :MemoryDisc Group Comment Logged
    Alarm_In_1 Kansas City Alarm In 1 for Kansas City Yes
    What I would like to be able to do is split the sections into each of their own worksheets, worksheets labelled with the section name, but carrying over also the row containing the header detail.

    Is this possible?

    I have played about with the macro recorder, and I can split the worksheet for one section but not having much luck cobbling together a better solution.

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Split worksheet into multiple worksheets with headers

    Can you attach a sample showing your data file and what you expect as your output.

    Go Advanced -> Manage Attachments -> Upload

  3. #3
    Registered User
    Join Date
    07-29-2018
    Location
    NZ
    MS-Off Ver
    2016
    Posts
    2

    Re: Split worksheet into multiple worksheets with headers

    Thanks, sample file uploaded.
    Attached Files Attached Files

  4. #4
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Split worksheet into multiple worksheets with headers

    Here is a Power Query solution;
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try This ‼


    According to your attachment a demo creating destination worksheets if necessary :

    PHP Code: 
    Sub Demo1()
               
    Dim Rg As RangeF&, L&, S$
        
    With Sheets("MainImport").UsedRange.Rows
               Set Rg 
    = .Columns(1).Find(":*", .Cells(1), xlValuesxlWhole)
            If 
    Not Rg Is Nothing Then
                    F 
    1
                    Application
    .ScreenUpdating False
                
    Do
                    
    IIf(Rg.Row FRg.Row 1, .Count)
                    
    Mid$(.Cells(F1).Value2)
                    If 
    Evaluate("ISREF('" "'!A1)"Then Sheets(S).UsedRange.Clear _
                                                         
    Else Sheets.Add(, Sheets(Sheets.Count)).Name S
                   
    .Item(":" L).Copy Sheets(S).[A1]
                    
    Sheets(S).UsedRange.Columns.AutoFit
                    
    If = .Count Then Exit Do
                    
    Rg.Row
                    Set Rg 
    = .Columns(1).FindNext(Rg)
                
    Loop
                    Set Rg 
    Nothing
                    Application
    .ScreenUpdating True
            End 
    If
        
    End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

+ 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] formula for multiple split headers of text and numbers to respective headers
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-19-2017, 10:17 AM
  2. Copy/Paste Columns from Multiple Worksheets based on Headers into new Worksheet
    By casper3043 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2015, 03:06 PM
  3. [SOLVED] Macro to split worksheet to multiple worksheets
    By daillest319 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-30-2013, 04:58 AM
  4. Split worksheet content into multiple worksheets
    By macaco20 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-14-2012, 01:49 AM
  5. Split worksheet content into multiple worksheets
    By Bell8oy in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-24-2012, 08:41 AM
  6. Split Worksheet into Several Worksheets using multiple columns
    By WBarrett in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-21-2011, 03:37 PM
  7. Split worksheet into multiple worksheets
    By ashtanga in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-12-2009, 04:43 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