Solved

move data to new sheets with same name

Posted on 2014-08-01
5
121 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
Comment Utility
sorry aditional info, I need the header row from my active sheet to be included on each sheet.

Thanks
0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
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
Comment Utility
its great except it did not put the header row in in left row 1 blank
0
 
LVL 48

Expert Comment

by:Rgonzo1971
Comment Utility
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
Comment Utility
My apologies that is brilliant. Thanks for all your help. Have a great weekend.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now