LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How to determine the end of the document

I am learning some excel programming for use in a ASP web site. I need
to select a range of cells and then process what I select. I am
getting along OK with that part, but how can I determine what to select
so that I avoid selecting rows that don't have any data?

EG, I have columns "A" through "O" to work with. There is some header,
title and report title text and basically some non-related things at
the top of the worksheet. Data starts at [A9]

If I knew that the report always ended at line 500, I could select
[A9:O500]- but the report varies in length.

here is a code sample of what I am doing: Any advice would be much
appreciated.

I am constrained by circumstances to use ASP.


Dim ExcelConn
Set ExcelConn = Server.CreateObject("ADODB.Connection")
With ExcelConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Extended Properties").Value = "Excel 8.0"
.Open Server.mappath("/Reports/Processing/ImportedInvoices/test.xls")
.Properties("Jet OLEDB:Max Buffer Size") = 256
End With


Dim objRs
Set objRs = Server.CreateObject("ADODB.Recordset")
With objRs
Set .ActiveConnection = ExcelConn
.Open "Select * from [Sheet1$A9:O500]" 'how do I know what to
select???
End With


Do While NOT objRs.EOF

Response.Write objRs.Fields.Item(0) & " " & objRs.Fields.Item(1) &
"<br"
objRs.MoveNext

Loop

objRs.Close
Set objRs = Nothing

ExcelConn.Close
Set ExcelConn = Nothing

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel won't open the original document!!! HannaBlack Excel Discussion (Misc queries) 5 July 19th 06 12:31 PM
Difficult for me, probably basic to you onlyjohn Excel Worksheet Functions 1 February 3rd 06 05:14 PM
Word found no merge fields in your main document. lburg801 Excel Discussion (Misc queries) 0 November 28th 05 08:01 PM
Help: Can't display contents of Adobe Acrobat Document in Sheet Dab Excel Discussion (Misc queries) 1 October 4th 05 02:20 AM
How to embed Word document into Excel and retain sizing, formatti. Kent Excel Discussion (Misc queries) 0 February 2nd 05 07:37 PM


All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"