I'm having a problem with VB.net in programming to import data either from an array or using QueryTables to import a .csv file. To preface this, I haven't had much experience with Excel in programming.
When I go to importing the data (currently trying the easier of the two methods (array)) yields me a "object reference not set to an instance of an object" error.
Here is the code that matters:
Dim excelApp As New Excel.Application
Dim excelBooks As Excel.Workbooks = excelApp.Workbooks
Dim excelBook As Excel.Workbook = excelBooks.Add
Dim excelWorksheet As Excel.Worksheet
excelApp.Visible = False
Dim excelRange As Excel.Range
excelWorksheet = excelApp.ActiveSheet()
Dim ctr As Long = 0
Dim args As Object
For ctr = 0 To ArrayCtr
args = HoldingArray(ctr)
excelRange.Cells((ctr + 4), 2) = args 'This is where the program throws the error
To clarify: HoldingArray is the global array that holds the data, and ArrayCtr is the static counter that holds the toprange of the array.