![]() |
Can Excel tell me how many rows are populated via a functions?
Hello All,
I wrote an application that takes a data set and uploads it to an Oracle database. I'm cheating a little right now by using a hard coded number of rows to parse and upload from a spread sheet to the database. I'm wondering if there is a function that I can use in the VBA code that will give me the number of rows that are populated so I can have my parser run dynamically versus having to use the hard coded number of rows. Many thanks, Josh |
Can Excel tell me how many rows are populated via a functions?
Josh,
ActiveSheet.UsedRange.Rows.Count will return the number of rows used on the worksheet. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Josh" wrote in message ... Hello All, I wrote an application that takes a data set and uploads it to an Oracle database. I'm cheating a little right now by using a hard coded number of rows to parse and upload from a spread sheet to the database. I'm wondering if there is a function that I can use in the VBA code that will give me the number of rows that are populated so I can have my parser run dynamically versus having to use the hard coded number of rows. Many thanks, Josh |
Can Excel tell me how many rows are populated via a functions?
Josh
To select the used range...... Sub select_range() Dim someCells As Range With ActiveSheet.UsedRange Range("A1").Select Set someCells = ActiveSheet.Range(ActiveCell, _ .Cells(.Cells.Count)) End With someCells.Select End Sub To return the last row number........... Sub FindLastRow() Dim LastRow As Long If WorksheetFunction.CountA(Cells) 0 Then 'Search for any entry, by searching backwards by Rows. LastRow = Cells.Find(What:="*", After:=[A1], _ SearchOrder:=xlByRows, _ searchdirection:=xlPrevious).Row MsgBox LastRow End If End Sub Gord Dibben Excel MVP On Tue, 30 Nov 2004 13:36:14 -0800, "Josh" wrote: Hello All, I wrote an application that takes a data set and uploads it to an Oracle database. I'm cheating a little right now by using a hard coded number of rows to parse and upload from a spread sheet to the database. I'm wondering if there is a function that I can use in the VBA code that will give me the number of rows that are populated so I can have my parser run dynamically versus having to use the hard coded number of rows. Many thanks, Josh |
All times are GMT +1. The time now is 12:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com