View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] deepaj87@hotmail.com is offline
external usenet poster
 
Posts: 6
Default Splitting Excel file into many workbooks

Hi,
I had tried that site, and it was good, except that I got stuck in
trying to tell it to come back to the 1st workbook and do it again.
Here's my code:

Sub Split_Presentations()


Dim app_path As String, dir_name As String, file_name As String, i
As Long, last_row As Integer, newCell As Long, newRow As Integer
Dim SelectedRow As Integer
Dim newInfo As String


app_path = Application.ActiveWorkbook.Path
dir_name = "\Workbooks\"
last_row = ActiveSheet.Cells.Find(what:="",
SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row

Application.DisplayAlerts = False
newInfo = "The information"


For i = 1 To last_row

Set rng = ActiveSheet.Cells.Find(newInfo)
Rows(rng.Row).Activate
Set myrng = Range(Cells(ActiveCell.Row + 1, "A"), Cells(Rows.Count,
"B"))
myrng.Select
myrng.Copy
file_name = "Presentation " & i


Workbooks.Add
Workbooks(Workbooks.Count).Sheets(1).Paste
Workbooks(Workbooks.Count).Sheets(1).Range("A1").S elect
ActiveWorkbook.SaveAs Filename:=app_path & dir_name & file_name
& ".xls"
Workbooks(Workbooks.Count).Close

Exit For

Next i

End Sub


Thanks so much for your help!