I've written code to link to excel and extract data from spreadsheet. The data set is in 67 rows, and I need to extract header information from rows 2 & 3. The rest of the data resides in columns D & E and I need to extract it and write to an access table. I keep getting hung up on the Dimension Statements.
rivate Sub Import_from_Excel_Click()
Dim objExcel As Object
Dim objWorkbook As Object
Dim objsheet As Object
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim nitems, last
Set objExcel = GetObject("c:\my Documents\assessment.xls")
Set objsheet = objWorkbook.sheets("Assessments")
ans = ActiveCell.Row: nitems = ans / 67
I get a compile error Variable not defined on the "(xlLastCell)"
Well, without really delving into this, I'ld say that xlLastCell is a integer variable that should contain the Index number of the cell to select. You need to be selecting and processing each cell according to its Index number.
See your Excel help system for SpecialCells. You should be able to view a example of how to use it.
Self Taught In ALL Environments.....And It Shows!