https://stackoverflow.com/questions/112 ... xcel-sheet
My Example:
Code: Select all
Sub a_import()
Dim wbI As Workbook, wbO As Workbook
Dim wsI As Worksheet
Set wbI = ThisWorkbook
Set wsI = wbI.Sheets("modeledHead") 'Sheet where the modeled heads are import to.
filePath = ActiveWorkbook.Path & "\dirTRg\"
inputSheet = "1_hydrograph_x.dat" ' Data file name without .csv extension.
inputFile = filePath & inputSheet
Set wbO = Workbooks.Open(inputFile)
wbO.Sheets(1).Cells.Copy wsI.Cells
wbO.Close SaveChanges:=False
End Sub