I'm working on VB file that determine specific content based on cell value, queue it, update in separate tabs copy&save those tabs into new workbook. Workbook name is define by cell and for every data individual. Everyting works for me perfectly correct, but new woorkbooks (even when they have different names) have all the same data inside (assigned to last value from queue). Data in the tabs is based on VLOOKUP formula [and connected to cell value in Sheets("Sheet1").Cells(1, 5) = Sheets("Sheet1").Cells(i, 1)]. Any ideas how to force VB so it will copy proper data to proper workbooks - not only last in queue? The code :
VBA Code:
ub Auto()
Dim InitFileName As String, fileSaveName As String
Dim i As Integer
For i = 7 To 8
Sheets("Sheet1").Cells(1, 5) = Sheets("Sheet1").Cells(i, 1)
fileSaveName = "FILES DESTINATION FOLDER\test " & Sheets("Sheet1").Cells(1, 16) & ".xlsx"
Worksheets(Array("1", "2", "3")).Copy
Set wbNew = ActiveWorkbook
With wbNew
.SaveAs fileSaveName
.Close
End With
Next i
End Sub