Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to code some VBA for a spreadsheet. Not all th
spreadsheets I will be using it on are of exactly the same length, so am trying to find a way to get a count of all of the rows that hav information in them so I can use that to set up my references. Is there a way to do this short of searching for an empty row? I wa thinking there might be a property that would give me a row count bu have been unable to find anything to do what I need. Thanks -Jak -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jake,
Using column A to establish the last row, try: : Cells(Rows.Count, "A").End(xlUp).Row --- Regards, Norman MsgBox Cells(Rows.Count, "A").End(xlUp).Address "jdwhytie " wrote in message ... I am trying to code some VBA for a spreadsheet. Not all the spreadsheets I will be using it on are of exactly the same length, so I am trying to find a way to get a count of all of the rows that have information in them so I can use that to set up my references. Is there a way to do this short of searching for an empty row? I was thinking there might be a property that would give me a row count but have been unable to find anything to do what I need. Thanks -Jake --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jake,
There are a variety of ways to do this, depending on the organization of your worksheet. For example, Dim NumRows As Long NumRows = Worksheets("Sheet1").UsedRange.Rows.Count ' or NumRows = Worksheets("Sheet1").Cells(Rows.Count,"A").End(xlU p).Row -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "jdwhytie " wrote in message ... I am trying to code some VBA for a spreadsheet. Not all the spreadsheets I will be using it on are of exactly the same length, so I am trying to find a way to get a count of all of the rows that have information in them so I can use that to set up my references. Is there a way to do this short of searching for an empty row? I was thinking there might be a property that would give me a row count but have been unable to find anything to do what I need. Thanks -Jake --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect, just what I was looking for, thank you bot
-- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count all rows in column with data, Except rows 1-5 | Excel Worksheet Functions | |||
match week, count rows, sum rows? | Excel Worksheet Functions | |||
Count number of rows, where non relevant rows are hidden | Excel Discussion (Misc queries) | |||
Count rows and insert number to count them. | Excel Discussion (Misc queries) | |||
Why does rngDataSource.Rows.Count = 65536 when worksheet Rows=95? | Excel Discussion (Misc queries) |