View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default 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