Hello there.

What I'm trying to do is write a VBA command that opens up a windows pop up box so that I can select a file. From this selected file, I'd like to copy a few data, to another excel file.

My current code is as follows,

Private Sub CommandButton1_Click()
      
    Dim wbTarget As Workbook
    Dim wbOrigen As Workbook
     
    Dim shTarget As Worksheet
    Dim shOrigen As Worksheet
     
    Set wbTarget = Workbooks("D21 - Database.xlsm") 'DO NOT CHANGE
    Set wbOrigen = Workbooks("D21 07012015.xls") 'CHANGE THE FILE NAME AS REQUIRED: eg, D35 1 January 15, D35  2 January 15 etc etc
    Set shTarget = wbTarget.Worksheets("FLP") 'DO NOT CHANGE
    Set shOrigen = wbOrigen.Worksheets("Sheet1") 'DO NOT CHANGE
  
  
    shOrigen.Range("N14:N16").Copy 'RANGE NEEDS TO BE CHANGED IF THE FORMAT IN THE DAILY REPORT CHANGES: eg, R75:R78, R77:R80, R78:R81 etc etc
    shTarget.Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
           
    Application.CutCopyMode = False
     
    Set shOrigen = Nothing
    Set shTarget = Nothing
    Set wbTarget = Nothing
    Set wbOrigen = Nothing
     
    
End Sub
In this code, I need to change the file name in order for me to access that file. Instead of doing that, I'd like to just select the file so that in the future, I don't have to keep opening the codes AND change the filename. Everything else stays the same.

Here's a summary of what I'd like to do:

1.Open the database.
2.Click the command button.
3.Windows Pop Up box appears.
4.Select the latest file.
5.Copy the data accordingly (as seen in the code)

Plus, this new database will be passed to someone else who does not know much about coding, so my concern is that he/she might mess things up. That's why I'd rather just do the above procedures.

Your help will be very much appreciated!