title: Using filedialog in VBA
body: <p>I usually just google and eventually find an answer but this time I am really stuck. I am not that familiar with VBA and how it works but got the basic idea.</p>
  
  <p>What I am trying to do is to collect data from a number of .lvm files and put it in a graph. The .lvm files are text files with tab-separated columns and they contain text as well as decimal numbers.</p>
  
  <p>I want to select several files from a filedialog and copy one column from the file and put it in a graph. I am able to copy the column but when I copy the value as text instead of number. When I open the file in Excel normally the values have format "General" and I can make graphs from it. But when the file gets opened by filedialog something is happening with the format. My code looks like this (so far):</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
  Dim fd As FileDialog
  Dim FileChosen As Variant
  Dim FileName As String
  Dim i As Integer
  Set fd = Application.FileDialog(msoFileDialogFilePicker)
  'use the standard title and filters, but change the
  'initial folder
  fd.InitialView = msoFileDialogViewList
  'allow multiple file selection
  fd.AllowMultiSelect = True
  
  FileChosen = fd.Show
  
  If FileChosen = -1 Then
  'open each of the files chosen
  
      For i = 1 To fd.SelectedItems.Count
          Workbooks.Open fd.SelectedItems(i)      
  
          Sheets(1).Range("B23:B" &amp; Range("B23").End(xlDown).Row).Copy
          Application.DisplayAlerts = False
          ActiveWorkbook.Close
          ThisWorkbook.Sheets("Sheet2").Activate
          Sheets("Sheet2").Select
          Sheets("Sheet2").Cells(1, i * 1).Select
  
          ActiveSheet.Paste
  
          Application.DisplayAlerts = True
      Next i
  
  End If
  
  End Sub
  </code></pre>
  
  <p>My source looks something like this:
  <code>"Lots of text until row 23" 
  0,1 0,2 0,4 0,5 0,7 0,8 
  0,9 0,2 0,5 0,2 0,1 0,1 
  0,1 0,2 0,4 0,5 0,7 0,8 
  0,9 0,2 0,5 0,2 0,1 0,1 
  0,1 0,2 0,4 0,5 0,7 0,8 
  0,9 0,2 0,5 0,2 0,1 0,1 
  0,1 0,2 0,4 0,5 0,7 0,8</code></p>
  
  <p>There are a lot more rows in the original file and it has five digits after the decimal separator</p>