VBA MOD01 Methods to find last Row

 Methods to find last Row


Public Sub MethodsToFindLastRow()

'USE END PROPERTIES OF RANGE OBJEct
Range("K6").Value = Cells(Rows.Count, 1).End(xlUp).Row
'OR
Range("K6").Value = Range("A4").End(xlDown).Row

'EXAMPLE FOR LAST COLUMN
Range("K8").Value = Cells(4, Columns.Count).End(xlToLeft).Column

'USE THE CURRENT REGION PROPERTY OF RANGE OBJECT
Range("K10").Value = Range("A4").CurrentRegion.Rows.Count

'USE SPECIALCELLS METHOD OF RANGE OBJECT
Range("K11").Value = Cells.SpecialCells(xlCellTypeLastCell).Row


'USE USE RANGE PROPERTY OF WORKSHEET OBJECT
Range("K12").Value = Application.ActiveSheet.UsedRange.Rows.Count


End Sub


Comments

Popular posts from this blog

VBA01 Copy Resize Variably Sized Ranges

VBA MOD01 Passing Arguments to sub procedures (ByRef , By Val)

PY MOD01 Lecture 01