Wrox Programmer Forums
|
BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2
This is the forum to discuss the Wrox book Excel 2007 VBA Programmer's Reference by John Green, Stephen Bullen, Rob Bovey, Michael Alexander; ISBN: 9780470046432
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 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 January 12th, 2010, 12:42 PM
Registered User
 
Join Date: Jan 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Find empty row

Hi,

I am trying to insert data into cells. I want to find the last empty row and then dynamically insert data.

This is working ok with this code:

r = Application.WorksheetFunction.CountA(Range("A:A")) + 1

BUT I have my data hidden away in cells CS onwards... How do I use the above or another method? Also, anyway I can use this to find a rolling number, kind of like a autonumber?

I tried the below ALL failing:

r = Application.WorksheetFunction.CountA(Range("A:CS") ) + 1

r = Application.WorksheetFunction.CountA(Range("CS:CS" )) + 1

r = Application.WorksheetFunction.CountCS(Range("CS:CS ")) + 1

r = Application.WorksheetFunction.CountCS(Range("A:CS" )) + 1

Thanks in advance
 
Old June 18th, 2010, 11:43 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Count functions like CountA provide the no of rows. If you want the first blank row etc you need to use

Cells.SpecialCells(xlCellTypeLastCell).Row

or

Cells(ActiveSheet.Rows.Count, "E").End(xlUp).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
find the FIRST USED row/column? crmpicco Excel VBA 3 July 23rd, 2013 12:52 PM
Find a Row in Datatable everest C# 1 August 1st, 2007 03:01 PM
Find Datagrid selected row vije ASP.NET 1.0 and 1.1 Basics 3 August 23rd, 2005 10:05 AM
import excel file and stop at first empty row derik SQL Server DTS 2 September 24th, 2004 04:16 AM
Find total row count when databinding guppyheart BOOK: ASP.NET Website Programming Problem-Design-Solution 0 September 17th, 2003 07:40 PM





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