Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to loop through all the rows on a worksheet ...
There are patches where there are groups of existing but unused rows .... How do I get the last used row in VBA? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like the following. Change the "A" to the
appropriate column. Dim LastRow As Range Set LastRow = Cells(Rows.Count, "A").End(xlUp) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message oups.com... I need to loop through all the rows on a worksheet ... There are patches where there are groups of existing but unused rows ... How do I get the last used row in VBA? Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try:
Sub Find_lur() Dim j, i, k As Long ' gsnu find last used row k = 0 j = 65536 For i = j To 1 Step -1 If Application.CountA(Rows(i)) = 0 Then Else k = i Exit For End If Next i MsgBox (k) End Sub -- Gary''s Student " wrote: I need to loop through all the rows on a worksheet ... There are patches where there are groups of existing but unused rows .... How do I get the last used row in VBA? Thanks. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Chip.
Where almost there... How do I get the integer value of the last row from the Range LastRow ? Dim LastRow As Range Set LastRow = Cells(Rows.Count, "A").End(xlUp) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message oups.com... I need to loop through all the rows on a worksheet ... There are patches where there are groups of existing but unused rows ... How do I get the last used row in VBA? Thanks. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim LastRowNumber as long
lastrownumber = lastrow.row wrote: Thanks Chip. Where almost there... How do I get the integer value of the last row from the Range LastRow ? Dim LastRow As Range Set LastRow = Cells(Rows.Count, "A").End(xlUp) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message oups.com... I need to loop through all the rows on a worksheet ... There are patches where there are groups of existing but unused rows ... How do I get the last used row in VBA? Thanks. -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I get the integer value of the last row from the Range
LastRow ? LastRow.Row -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message ups.com... Thanks Chip. Where almost there... How do I get the integer value of the last row from the Range LastRow ? Dim LastRow As Range Set LastRow = Cells(Rows.Count, "A").End(xlUp) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message oups.com... I need to loop through all the rows on a worksheet ... There are patches where there are groups of existing but unused rows ... How do I get the last used row in VBA? Thanks. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oh ... Sweet.
Thanks guys. Dim val as Integer val = sheet.Cells(rows.Count, "A").End(xlUp).Row |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|