Solved

move data to new sheets with same name

Posted on 2014-08-01
5
124 Views
Last Modified: 2014-08-01
from my active sheet I need to move data to a new sheet that has the same name as the name in column J [Ref]

so Rows go from A to S and I need all data from activesheet for CLOVC to be put on Sheet Named ClOVC, all data for BKIDQ to be put on sheet named BKIDQ etc etc

   Ref
CLOVC
CLOVC
CLOVC
BKIDQ
BKIDQ
CLOVC
SUUKG
MSSU0

Thanks in Advance.
0
Comment
Question by:Jagwarman
  • 3
  • 2
5 Comments
 

Author Comment

by:Jagwarman
ID: 40233847
sorry aditional info, I need the header row from my active sheet to be included on each sheet.

Thanks
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40233856
Hi,

pls try

Sub macro()
Set OrigSh = ActiveSheet
For Each c In Range(Range("J2"), Range("J" & Rows.Count).End(xlUp))
    If c.Offset(0, -8) = Date Then
        On Error Resume Next
        Set Sh = Nothing
        Set Sh = ActiveWorkbook.Worksheets(c.Value)
        On Error GoTo 0
        If Sh Is Nothing Then
            ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
            Worksheets(Worksheets.Count).Name = c.Value
            OrigSh.Range("A1").EntireRow.Copy ActiveWorkbook.Worksheets(c.Value).Range("A1")
        End If
        c.EntireRow.Copy ActiveWorkbook.Worksheets(c.Value).Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If
Next

Open in new window

Regards
0
 

Author Comment

by:Jagwarman
ID: 40233885
its great except it did not put the header row in in left row 1 blank
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40233888
My code copies Row 1 (EDIT not A) in the active sheet and copies it in the sheet but only if the sheet does not already exist
0
 

Author Comment

by:Jagwarman
ID: 40233919
My apologies that is brilliant. Thanks for all your help. Have a great weekend.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best prediction based on two lists of numbers  in excel 2 44
Select Next Route by Time 4 20
sort column using vba 2 19
sumifs excel 2013 3 16
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question