Copy/Paste to new worksheets based on identifier

livingston1122

New Member
Joined
Mar 2, 2015
Messages
6
Hi there!
I have a large worksheet that gets pulled monthly that I need to break out into separate worksheets and then further into individual client workbooks. I have created a macro that adds an identifier (Job#) in Column A. Ideally, this code would blast each row associated with an individual Job# into a separate tab, labeled as that Job#. The range needs to be col A:X, however each column within that range, does not necessarily have a value, nevertheless, all columns must export.

If this could go a step further and save all job#'s associated with a specific client to a separate workbook, that would be ideal. I can add a column A or B to the sheet to identify the client, as necessary.

Any help would be wonderful! I've gotten close but my range stops at column D and my sheet names are random ( some Sheet#, some Job#).
THANK YOU!!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi there!
I have a large worksheet that gets pulled monthly that I need to break out into separate worksheets and then further into individual client workbooks. I have created a macro that adds an identifier (Job#) in Column A. Ideally, this code would blast each row associated with an individual Job# into a separate tab, labeled as that Job#. The range needs to be col A:X, however each column within that range, does not necessarily have a value, nevertheless, all columns must export.

Hi livingston1122,

Try this modified code from a google search.
The code line in blue will copy to the new sheet on the same row as the Job# is on sheet1.

Howard

Code:
Option Explicit

Sub Col_A_SheetsWithNames()

Dim sheetCount As Long
Dim sheetName As String
Dim workbookCount As Long, i As Long

With ActiveWorkbook
    sheetCount = Sheets(1).Range("A2").End(xlDown).Row
  For i = 2 To sheetCount Step 1
    sheetName = .Sheets(1).Range("A" & i).Value
    workbookCount = .Worksheets.Count
     .Sheets.Add After:=Sheets(workbookCount)
     .Sheets(i).Name = sheetName
    '[COLOR="#0000FF"].Sheets(i).Range("A" & i, "X" & i).Value = .Sheets(1).Range("A" & i, "X" & i).Value[/COLOR]    
     .Sheets(i).Range("A" & Rows.Count).End(xlUp)(2).Resize(1, 24).Value _
       = .Sheets(1).Range("A" & i).Resize(1, 24).Value
  Next 'i
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top