importing data excel access

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » Importing data from excel to access using automation within acce

Importing data from excel to access using automation within acce

resolvedResolved · Low Priority · Version 2007

James has attended:
Access Advanced course
Access VBA course

Importing data from excel to access using automation within acce

Within access vba I can open a new excel session and browse and open an excel file. I then can go to cell "a1". My problem is going from there. I want to do the excel command .end(xldown), I then want to record what row the last row of data is on.

I have tried an alternative to the above which was:
lrow = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

but this does not seem to work

RE: Importing data from excel to access using automation within

Hi James,

Thank you for your question and welcome to the forum.

This small bit of code will highlight the last row in your table that contains data:


Sub FindLastRow()

Dim intRow As Integer

intRow = Range("A1").CurrentRegion.Rows.Count

Rows(intRow).Select

I hope this answers your question.

Regards

Simon




End Sub

Will be marked as resolved in 5 days

Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.

Tue 24 May 2011: Automatically marked as resolved.


 

Access tip:

Create own ribbon tab - Access 2010

a. In Access click on the File tab
b. Select Options from left hand side
c. Choose the Customize Ribbon section
d. Click the New Tab button (below the list of tabs on the right hand side of the dialog box)
e. Select the New Tab (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
f. Select the New Group (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
g. Add commands to your tab and group by locating them on the list on the right hand side (remembering that you can change the list using the drop down box at the top of the list of commands) and clicking the Add button between the two panes to add them to your tab and group
h. You can rearrange the commands in your group, the groups on any tab or the tabs, using the up and down arrow buttons beside the list of tabs.
i. Click OK to apply your changes

View all Access hints and tips


Server loaded in 0.1 secs.