Solved

determine total rows in Excel sheet (2003 or 2007)

Posted on 2014-02-02
4
393 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

840 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