Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find the last cell in an Excel Sheet using VBA

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
We get a daily Excel sheet from our Legacy system which
I am import into our Access database.
The Excel sheet has different amounts of information each day.
Sometimes the last cell is at cell H2345 sometimes it’s H1345
I currently use H10000 to get it all.
I would like to interrogate from Access VBA the last cell somehow.
Here is my code so far to import

Code:
    Dim ExcelRange As String
    Dim ExcelLocation As String
    ExcelLocation = "\\Pdc1\daceasy\oe\sampdata\test\SHIPMENTS.XLS"
    
    ExcelRange = "A5:G10000"
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "DailyShipment", ExcelLocation, True, ExcelRange

TIA


DougP, MCP, A+
 
Hi
Have a look in the FAQ section as there are at least 2 covering last cell/row/column.

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top