Pages Menu
Categories Menu

Posted by on Sep 23, 2013 in Code Snippets | 0 comments

Get the Row and Column Number of the Last Cell Containing Data

Get the Row and Column Number of the Last Cell Containing Data

 Sub FindDataExtent()

    Dim ws As Worksheet
    Set ws = ActiveSheet

    Dim iLastRow As Integer
    iLastRow = ws.Cells(ws.Rows.Count, "a").End(xlUp).Row

    Dim iLastCol As Integer
    iLastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column

 End Sub

 

Leave a Reply