Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005

    Red face Unanswered: Import from Excel

    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)"

  2. #2
    Join Date
    Nov 2003
    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!

  3. #3
    Join Date
    Nov 2002
    Quote Originally Posted by Glenn799
    I get a compile error Variable not defined on the "(xlLastCell)"
    I find xlCellTypeLastCell in the xlCellType enumeration. I've never used it, but it might be what you want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts