Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

move data to new sheets with same name

Posted on 2014-08-01
5
Medium Priority
?
131 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 53

Accepted Solution

by:
Rgonzo1971 earned 2000 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 53

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

773 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