title: how to copy columns from one excel file to another using vba
body: <p>I am very new to Excel and vba. </p>
  
  <p>I have an excel  file that contains a button that does the following hen clicked:</p>
  
  <p>it opens a stored file, copy columns A data and then create a new excel file and paste the copied data on it</p>
  
  <p>I have tried the following code but I have a problem in <code>selection.paste</code> line</p>
  
  <pre><code>Dim oExcel As Excel.Application
  Dim oWB As Workbook
  Set oExcel = New Excel.Application
  'Set oWB = oExcel.Workbooks.Open("C:\Users\omran.alhammadi\Desktop\power ana\4EC73A75.WD0.xls")
  Workbooks.Open Filename:="C:\Users\omran.alhammadi\Desktop\power ana\4EC73A75.WD0.xls"
  
  
  
  Rows("1:9").Select
      Selection.Delete Shift:=xlUp
      Columns("A:A").Select
      Selection.NumberFormat = "hh:mm:ss;@"
  
      Columns("A:A").Select
      Selection.Copy
  'Selection.NumberFormat = "dd/mm/yyyy hh:mm:ss;@"
  
  
  
  Set NewBook = Workbooks.Add
      With NewBook
          .Title = "temp"
          .Subject = "tempsub"
          .SaveAs Filename:="Temp.xls"
      End With
  
      Workbooks("temp.xls").Activate
  
  ActiveSheet.Columns("A:A").Select
   Range("A1").Paste
  Application.CutCopyMode = False
  
  
  
      '    NewBook("4EC73A75.WD0.xls").Activate
      '    Sheets("Sheet1").Activate
      '*** Select the destination cell
     ' Range("A1").Select
     ' ActiveSheet.Range("A1").Paste
  
      Workbooks("4EC73A75.WD0.xls").Close
  </code></pre>