DigDeep

Count Excel total rows (-1)

3 posts in this topic

#1 ·  Posted

I want to get the result in the form of (total rows - Header)

Using the below code, I can get the total rows which is including the header. How can I use '-1' in Excel?

Local $Lines = $oWorkbook.ActiveSheet.UsedRange.Rows.Count

MsgBox(0, '', $Lines)

Eg: if the $Lines = 4 ; Total rows

The result should be 4 - Row1 = 3

Share this post


Link to post
Share on other sites



#2 ·  Posted

DigDeep,

See this...

kylomas

1 person likes this

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#3 ·  Posted

Thanks @kylomas

I just tried as per below and it showed up correctly.

Local $Lines = $oWorkbook.ActiveSheet.UsedRange.Rows.Count

MsgBox(0, '', $Lines - 1)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now