I dont know why i am having a lapse in brainwave activity but I cannot figure how to set the variable source worksheet = to the workbook source 1st sheet. I am looking to go into a named file folder and extract data from variable named file folders that each contain .xls files and copy and paste all copied data to the same new worksheet. My code breaks down and throws an error at the same location. If anyone can advise how to reference the first sheet using the set property that would be greatly beneficial. Below is a snippet of my code and the last line is where it breaks
Sub collatefiles()
Dim strDirContainingFiles As String, strFile As String, _
strFilePath As String
Dim wbkDst As Workbook, wbkSrc As Workbook
Dim wksDst As Worksheet, wksSrc As Worksheet
Dim lngIdx As Long, lngSrcLastRow As Long, _
lngSrcLastCol As Long, lngDstLastRow As Long, _
lngDstLastCol As Long, lngDstFirstFileRow As Long
Dim rngSrc As Range, rngDst As Range, rngFile As Range
Dim colFileNames As Collection
Set colFileNames = New Collection
'Set references up-front
strDirContainingFiles = "Z:\Manufacturing\SensorRepo\2468\TestResults\AATF\"
Set wbkDst = Workbooks.Add
Set wksDst = wbkDst.ActiveSheet
strFile = Dir(strDirContainingFiles & "*.xls")
Do While Len(strFile) > 0
colFileNames.Add Item:=strFile
strFile = Dir
Loop
'Now we start looping through each source file and copy data
'to our destination sheet
For lngIdx = 1 To colFileNames.Count
'Assign the file path
strFilePath = strDirContainingFiles & colFileNames(lngIdx)
'Open the workbook and store a reference to the data sheet
Set wbkSrc = Workbooks.Open(strFilePath)
Set wksSrc = wbkSrc.Sheets(1)
Bookmarks