So I know there have been questions on this before, but none seem to explicitly solve the problems I'm having. Effectively what I'm trying to do is create a new workbook, copy and paste data into it, and then save that new workbook under a new filename. No matter what I do, I seem to get various types of error messages.
Here is my code. Any help is very appreciated!
Private Sub DoStuff()
CurrentFile = "June_Files_macros_new.xlsm"
NewFile = "Train10_June01.xls"
Workbooks.Add
'Save New Workbook
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & NewFile
For i = 2 To 55
If Cells(i, 3) = Cells(i - 1, 3) And Cells(i, 13) = Cells(i - 1, 13) Then
Workbooks(CurrentFile).Worksheets("Sheet1").Rows(i).Copy _
Workbooks(NewFile).Worksheets("Sheet1").Rows(i)
Else: Workbooks(NewFile).SaveAs ThisWorkbook.Path & "\" & "New_Name"
End If
Next i
End Sub
It seems to me that the "New_Name" is causing all my problems, but I'm open to changing anything that will allow this to work.
Thanks so much! Zach
ps I'm relatively new to VBA so please try to keep any explanations somewhat simple!