How do I know a data range of Excel in Access

  • Thread starter Thread starter joyo
  • Start date Start date
J

joyo

I want to transfer the Excel file to Access table. I am
using the "transferspreedsheet" function. I have a form
let the user tell me the begin unit and end unit and file
location. How do I find the invalid entry. For example,
the data in Excel file is a1 to u1600, How do I avoid the
user's entry over u1600. Because the Excel is different
every time, I can not set a fixed number. I would like to
know the data range of Excel file and show the numbers
(Begin unit and End unit) as reference for the users.

Thanks

joyo
 
Hi Joyo

I think the only way to do this would be to open the Excel file using
automation and check the UsedRange property of the Worksheet. Something
like this:

iMaxRow = oExcelApp.ActiveSheet.UsedRange.Rows.Count
iMaxCol = oExcelApp.ActiveSheet.UsedRange.Columns.Count
 
Back
Top