View Full Version : Importing Certain Excel Cells . . . What to do?


whoneeds8
02-01-2005, 08:22 AM
I want to import only the information from an excel sheet like the one below where the answers for Q1 and Q2 are No and Yes respectively.

http://www.dfwls1.com/hosting/albums/userpics/11225/excel.jpg

I'm using this code below that is working but importing all cells:
Private Sub Command31_Click()

DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel9, "CustomerRecords", "C:\Documents and Settings\mstafford\Desktop\CustomerRecords.xls", True, "C1:I20"

End Sub

What do I need to add?

Pat Hartman
02-01-2005, 07:23 PM
If you are asking how to import only rows 2, 5, 7 - you can't - unless you want to write code to automate excel. Import the whole sheet and then use a query to select just the rows you are interested in.

whoneeds8
02-02-2005, 06:07 AM
If you are asking how to import only rows 2, 5, 7 - you can't - unless you want to write code to automate excel. Import the whole sheet and then use a query to select just the rows you are interested in.


Duh, I'm an idiot. LOL . . . Thanks. :cool:

sportsguy
02-07-2005, 03:51 PM
attach the Excel file as a lnked table,
then write an append query to append only the
records that you want. . .

sounds so simple, and it really is

sportsguy