Full Version: Find the last cell location in an exported Table to Excel
UtterAccess Discussion Forums > Microsoft® Access > Access Automation
tbirdpepsi
I have used the following to create an Excel Spreadsheet and it works great
DoCmd.OutputTo acOutputQuery, "Qry_K1_Report_CrossTab_Setup", acFormatXLS, , True
I also use some VBA to change the height and reformat some cells in the spread sheet which
work fine also
I tried to add 2 rows to the top of the Spreadsheet to put other information from another table in
those top two rows.
the problem is I can not do an insert cause Excel doesnt reconize that the range from my last cell
and below is empty .. so it say it can not move non blank information beyond the last cell of the
worksheet.
If I manually go in to the spread sheet. go to the last row and delete or clear out all information
form the row below the last row of information to the bottom and do the insert command it works great.
question -- there are 2 ...
1. Is there a command that will give me (In Access) the last row of actual data in the Excel Spreadsheet
2. A way to clear all cells from the next row down to the very bottom of all information so I can
do the insert with out mannually clearing that range.

Or is it possable to do the above docmd.outputto and specify that area where there is no data do not
fill with any information
tkx.
tbirdpepsi
Here is the error message I get from Excel
To prevent possible loss of data, Microsoft Excel can not shift nonblank
cells off the worksheet ....
etc....
sad.gif tkx again for any help
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.