southcali12

New Member
Joined
Sep 22, 2015
Messages
28
Hello All!

I need some help with creating a workbook based on unique values in Column C. For every unique value in Column C, I would want a new workbook created and saved as with that unique value's name.

Thank you so much for your help in advance!:)

Example of what the workbook looks like (p.s. the sheet's name is TOGO):
DateOrder #Group
5/4/2016123Dan
5/5/2016456John
5/5/2016789Mary
5/6/20160123Jane

<tbody>
</tbody>

Code I found and am working with:
Sub CreateWorkbook()


Rem Copy Data From NRM_Homing_Upload
With ThisWorkbook.Sheets("TOGO")


Dim lRow As Long
lRow = .Range("A" & .Rows.Count).End(xlUp).row


With .Range("A1:C" & lRow)


.AutoFilter 3, "<>"


CopyToNewBook ThisWorkbook, ThisWorkbook.Sheets("TOGO"), .SpecialCells(xlCellTypeVisible), "Unique Value Name"


End With


.AutoFilterMode = False


End With


End Sub


Sub CopyToNewBook(wb As Workbook, ws As Worksheet, rng As Range, sFile As String)


Dim new_book As Workbook
Set new_book = Workbooks.Add


wb.Sheets(ws.name).Range(rng.Address).Copy


With new_book


With .Sheets(1)


.Range("a1").PasteSpecial (xlPasteAll)
.UsedRange.Columns.AutoFit
.UsedRange.RemoveDuplicates Columns:=3, Header:=xlYes


End With


.SaveAs Filename:="C:\Desktop\excel\test\" & sFile & ".xlsx"
.Close


End With


End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,215,013
Messages
6,122,694
Members
449,092
Latest member
snoom82

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