Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2014, 02:30 AM
Authorized User
 
Join Date: Nov 2014
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Weird behaviour of usedrange.rows function

HI,

I have been using Usedrange.Rows.Count function in most of my Macro Codes. It does very well. But in one sheet, it started counting as 1 row less than the total number of rows used.
That is, it shows 24 if 25 rows are used.
I copied the same data into another sheet. It showing properly. I am very curious to know what kind of error is this.
 
Old November 14th, 2014, 02:46 AM
Authorized User
 
Join Date: Nov 2014
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Sorry for the previous post - Understood d simple mistake

I understood that the formula uses only the number of rows used. It doesnt count empty rows if there are ny before the first used row.
 
Old November 14th, 2014, 08:58 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

You can try the following also to get the last row

Code:
Cells.SpecialCells(xlCellTypeLastCell).Row
Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Function to auto-number rows of parts pughpl BOOK: Access 2010 VBA Programmer's Reference 1 May 7th, 2014 08:37 PM
weird behaviour - chapter 6 User-selected theme lornarmac BOOK: Beginning ASP.NET 4 : in C# and VB 1 December 2nd, 2010 06:36 AM
Using Max function to return single rows. beerOne SQL Language 1 November 6th, 2008 04:52 PM
any explanation for this weird behaviour? hertendreef ASP.NET 2.0 Professional 0 April 11th, 2007 02:04 AM
Strange behaviour with IE smolds BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 October 15th, 2005 08:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.