Check the attachment. I have modified the position of the hidden columns.Code:Sub Export_DATA() Worksheets("Backlog-Raw Data").Range("J9:Q355").ClearContents With Application.FileDialog(msoFileDialogFilePicker) .AllowMultiSelect = False .ButtonName = "Open Raw Data" .Filters.Clear .Filters.Add "Excel Files", "*.csv" .Filters.Add "CSV File", "*.csv" .Title = "File Save As" .Show If .SelectedItems.Count Then strFileSelected = .SelectedItems(1) Else MsgBox "Cancelled by user!" Exit Sub 'Ideally, should exit from the bottom of the sub-routine. End If End With fncFileSelected = strFileSelected 'Need a code here that will lookup the contect of the file being opened and will copy and paste them the Book1.xlsm With Workbooks.Open(Filename:=fncFileSelected, ReadOnly:=True) .Sheets(1).Cells(1).End(xlToRight).Offset(, 2).Resize(, 8).Value = ThisWorkbook.Worksheets("Backlog-Raw Data").Range("J8:Q8").Value .Sheets(1).Cells(1).CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Sheets(1).Cells(1).End(xlToRight).Offset(, 2).CurrentRegion, Unique:=False With .Sheets(1).Cells(1).End(xlToRight).Offset(, 2).CurrentRegion ThisWorkbook.Worksheets("Backlog-Raw Data").Range("J8:Q8").Resize(.Rows.Count, .Columns.Count).Value = .Value End With Workbooks(.Name).Close 0 End With End Sub




Reply With Quote
Bookmarks