i have the following coe that works great. problem is it is stopping after only 77 rows instead of after 334. i=334 when the code runs, so i dont knwo why it is stopping. all i can think of is that it have something to do witht he fact that the folder i am putting ther files in get too full or something?? anyone see any probelms?
Code:
Sub CompleteForms()
Dim Vendor As String
Dim Vendor1 As String
Dim CurrentRow As String
Dim CurrentColumn As Long
Dim PasteRangeName As String
Dim XXX As String
Dim Edate As String
Application.DisplayAlerts = False
Application.ScreenUpdating = False
i = Sheets("data").Range("A2").End(xlDown).Row
For Each cell In Sheets("data").Range("A2:R" & i)
On Error Resume Next
CurrentRow = cell.Row
CurrentColumn = cell.Column
If CurrentColumn = 1 Then
Sheets("Template").Visible = True
Sheets("Template").Copy After:=Sheets(2)
Vendor1 = Sheets("Data").Range("B" & CurrentRow)
Vendor = Left(Vendor1, 12)
Sheets("Template (2)").Name = Vendor
Else
End If
PasteRangeName = Sheets("data").Cells(1, CurrentColumn).Value
cell.Copy
Sheets(Vendor).Range(PasteRangeName).PasteSpecial xlValue
If CurrentColumn = 18 Then ' 18 is column R
Edate = Sheets(Vendor).Range(Edate).Value
XXX = Format(Edate, "[$-409]ddmmmyyyy;@")
Folder = "C:\Users\tphythian\Documents\Vendor Evaluations"
ThisWorkbook.Worksheets(Vendor).Copy
With ActiveSheet.UsedRange
.Value = .Value
End With
With ActiveWorkbook
.SaveAs Folder & "\" & Vendor & " - " & XXX & ".xlsx"
.Close
End With
Sheets(Vendor).Delete
Else
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Worksheets("Template").Visible = False
MsgBox "All Vendor Evaluations have been created and saved in the Vendor Evaluations folder!"
End Sub