Solved

determine total rows in Excel sheet (2003 or 2007)

Posted on 2014-02-02
4
411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
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…

729 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