How could i get the below code to work with a variable as the file name?
Or could I use something like "thisfile" to determine where to import to.
Dim SV5 as String
SV5 = My File.xlsm
Do While fileName <> ""
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
total = Workbooks("exportedCSV.csv").Worksheets.Count
Workbooks(fileName).Worksheets(sheet.Name).Copy _
After:=Workbooks("My File.xlsm").Worksheets(total)
'After:=Workbooks("SV5").Worksheets(total)
Next sheet
Workbooks(fileName).Close
fileName = Dir()
Loop
thanks in advance
Bookmarks