ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create seperate xls files with names based on cell text (https://www.excelbanter.com/excel-programming/290841-create-seperate-xls-files-names-based-cell-text.html)

TroyB[_2_]

Create seperate xls files with names based on cell text
 
Hi,
I've got a summary worksheet where the user inputs all the relevant "input"
information. I'd like to create a macro that uses all the information in
column B (ie B2 = 1111, B3 = 1112, B4=1113 etc ) and create individual
workbooks titled 1111.LC.xls, 1112.LC.xls, 1113.LC.xls etc and have them
saved in a directory I:\Invoices\

What is the code i need to accomplish this?
Thanks in advance. These newsgroups are great!
Troy






Rob van Gelder[_4_]

Create seperate xls files with names based on cell text
 
Sub test()
Const cPath = "I:\Invoices\"

Dim wkb As Workbook, i As Long, lngLastRow As Long

With ActiveSheet
lngLastRow = .Cells(Rows.Count, 2).End(xlUp).Row
For i = 2 To lngLastRow
Set wkb = Workbooks.Add
wkb.SaveAs cPath & .Cells(i, 2).Value
wkb.Close
Next
End With
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"TroyB" wrote in message
u...
Hi,
I've got a summary worksheet where the user inputs all the relevant

"input"
information. I'd like to create a macro that uses all the information in
column B (ie B2 = 1111, B3 = 1112, B4=1113 etc ) and create individual
workbooks titled 1111.LC.xls, 1112.LC.xls, 1113.LC.xls etc and have them
saved in a directory I:\Invoices\

What is the code i need to accomplish this?
Thanks in advance. These newsgroups are great!
Troy









All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com