Hello,

Can someone please help me adjust the following code to pull data from the Last Used Column in the source workbooks, thus replacing the "B" column designation? I do not want the code to require adjusting the column value, and instead, simply search for the last column with data on the source workbook to copy to the destination workbook.

Thanks

Sub datacollect()
  
Dim C As Long
  Dim DstWks1 As Worksheet
  Dim LastRow As Long
  Dim R As Long
  Dim SrcWkb As Workbook
  Dim StartRow As Long
  Dim wkbname As Variant
  Dim xlsFiles As Variant
  
   'Starting column and row for the destination workbook
    C = 2
    R = 2
   'Set references to destination workbook worksheet objects
    Set DstWks1 = ThisWorkbook.Worksheets("Data")
    
   'Starting row on source worksheet
    StartRow = 1
    
   'Get the workbooks to open
    xlsFiles = Application.GetOpenFilename(FileFilter:="Excel files (*.xls), *.xls", MultiSelect:=True)
    Application.AskToUpdateLinks = False
      If VarType(xlsFiles) = vbBoolean Then Exit Sub
      
     'Loop through each workbook and copy the data to this workbook
      For Each wkbname In xlsFiles
        Set SrcWkb = Workbooks.Open(Filename:=wkbname, ReadOnly:=True)
          LastRow = SrcWkb.Worksheets("Equity").Cells(Rows.Count, "B").End(xlUp).Row
            If LastRow >= StartRow Then
              With SrcWkb.Worksheets("Equity")
                DstWks1.Cells(R, C).Resize(LastRow - StartRow + 1, 1).Value = _
                .Range(.Cells(StartRow, "B"), .Cells(LastRow, "B")).Value
              End With
            End If
        C = C + 1
        SrcWkb.Close savechanges:=False
      Next wkbname
      
End Sub