I'm trying to open an excel workbook and read the data from sheet1. when it gets to the "With Workbooks(xyz).sheets(Sheet1)" it gives me an error "Run-Time error '9': Subscript out of range.
Also when I try and close the workbook, it gives me an error. Any help would be appreciated.
Danka
Also when I try and close the workbook, it gives me an error. Any help would be appreciated.
Danka
Code:
Public Sub imporCord()
Dim RowNum As Integer
RowNum = 1
Dim easting(), northing(), elevation() As Double
Dim boring As String
Dim selection As String
Dim xyz As String
' selection = Application.GetOpenFilename("MIP Files (*.xls), *.xls")
xyz = ("Z:\Advanced Site Characterization\Public Folder\Project Folder\2014\14.0089 - Johnson Company - Flowery Branch, GA\Data from JCO\MIP_location_XYZ.xlsx")
Workbooks.Open (xyz)
With Workbooks(xyz).Sheets(Sheet1)
End With
Workbooks.Close (xyz)
End Sub