title: Excel vba user to select workbook then copy data
body: <p>I have a macro that will copy data from a csv file to my excel file and works great if the file name is the same every time. That's where the problem lies: it's not the same name every time. </p>
  
  <p>I need the script to allow a user to select the csv file. Then, the code to allow it to copy. This is what I have:</p>
  
  <pre><code>Sub importmix()
  
      Worksheets("mixdata").Range("A1:P300").Clear
  
      '## Open workbooks first:
      Set X = Workbooks.Open("C:\test\mix.csv")
      '## Set values between workbooks
      Workbooks("2.xlsm").Worksheets("mixdata").Range("A1:K300").Value = _
          Workbooks("mix.csv").Worksheets("mix").Range("C1:M300").Value
  
      '##Close x:
      X.Close False
  End Sub
  </code></pre>