I have the following code , which allows me to select various files and the code works perfectly
I would , however, like the code to be amended so that after the first file is selected, then that file in the folder is to be highlighted (or other means ) , so that the user can see which file was last selected. Once the next file is selected, then that file to be highlighted etc
Your assistance in this regard is most appreciated
Sub copyDataFromSource()
Clear_Data
filesource:
Dim filesource
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
filesource = Application.GetOpenFilename
If filesource = False Or IsEmpty(filesource) Then Exit Sub
With Workbooks.Open(filesource)
With .Sheets(4)
.Range("A2", .Range("A" & Rows.Count).End(xlUp)).Copy
ThisWorkbook.Sheets("Query sheet").Range("H" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
.Range("C2", .Range("C" & Rows.Count).End(xlUp)).Copy
ThisWorkbook.Sheets("Query Sheet").Range("J" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
.Range("D2", .Range("D" & Rows.Count).End(xlUp)).Copy
ThisWorkbook.Sheets("Query sheet").Range("L" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
.Range("B2", .Range("B" & Rows.Count).End(xlUp)).Copy
ThisWorkbook.Sheets("Query Sheet").Range("O" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
.Range("E2", .Range("E" & Rows.Count).End(xlUp)).Copy
ThisWorkbook.Sheets("Query Sheet").Range("AI" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End With
.Close False
End With
answer = MsgBox("Does another file needs to be selected?", vbYesNo + vbQuestion, "Hello")
If answer = vbYes Then
GoTo filesource:
End If
Formulas
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Bookmarks