Solved

determine total rows in Excel sheet (2003 or 2007)

Posted on 2014-02-02
4
384 Views
Last Modified: 2014-02-02
hey guys,

i've got this code

        Select Case penmExcelVersion
            Case enmExcel2003
                intLastRowOfSheet = 65536
            Case enmExcel2007
                intLastRowOfSheet = 1048576
        End Select

Open in new window


Question: what's the best way to check if the excel sheet i'm looking at has 65536 rows or 1048576 rows?

Homework: i can't use Application.Version because Excel 2007 can also create Excel 2003 sheets (.xls) which has 65536. i can't use the extension name (or rather it's not that reliable) because if i'm detecting for .xls, what if there's an xlt? yes i can list down all the Excel 2003 extensions but doesn't seem very elegant.
0
Comment
Question by:developingprogrammer
4 Comments
 
LVL 16

Assisted Solution

by:Peter Kwan
Peter Kwan earned 167 total points
ID: 39828674
You may use:

Sheet1.Range("A:A").End(xlDown).Row
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 167 total points
ID: 39828679
intLastRowOfSheet = sheet1.rows.count
0
 
LVL 18

Assisted Solution

by:Steven Harris
Steven Harris earned 166 total points
ID: 39828689
ActiveSheet.Rows.Count
0
 

Author Closing Comment

by:developingprogrammer
ID: 39828691
whao fantastic guys! i've always been looking for something like this but using workarounds instead - now i feel so much more like a complete person ha = ) thanks guys!! = ))
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question