I am trying to transfer some data from excel to an array in VB so that it can be used later on in my code. I have imported the office interop and defined what excel woorkbook to open and the correct sheet to activate. However once I rune through the loop I get the error "System.InvalidCastException: 'Conversion from type 'Range' to type 'Double' is not valid.'"
Is anyone familiar with this and point me in the right drection over what the error is?
Dim OSpointsX(8) As Double
Dim OSpointsY(8) As Double
Dim MyExcel As New Excel.Application
MyExcel.Workbooks.Open("...\Dims Update sheet 3D.xlsx")
'extract
MyExcel.Sheets("Sheet2").activate()
For i = 0 To 8
OSpointsX(i) = MyExcel.Cells(i + 3, 1)
OSpointsY(i) = MyExcel.Cells(i + 3, 2)
Next i