Forum Discussion

Malcolm McMaster's avatar
Malcolm McMaster
Copper Contributor
May 29, 2017
Solved

Excel 2016 Macro required

Need a macro to locate either the last cell containing data or the next empty cell in a column. Any help would be appreciated

  • Hi Malcolm,

     

    if you were to find last cell in a current range from a selected cell, you can use the following code

     

    Sub JumpToLastCellOfRange()
        Selection.End(xlDown).Select
    End Sub

     

    This assumes, that there are no blanks below the selected cell, otherwise, it will jump to the last non-empty cell before blank cell. 

     

    Some examples are also provided in http://www.ozgrid.com/VBA/ExcelRanges.htm

     

    Hope this helps. Please let me know if you require something else.

     

    Yury

     

  • Yury Tokarev's avatar
    Yury Tokarev
    Steel Contributor

    Hi Malcolm,

     

    if you were to find last cell in a current range from a selected cell, you can use the following code

     

    Sub JumpToLastCellOfRange()
        Selection.End(xlDown).Select
    End Sub

     

    This assumes, that there are no blanks below the selected cell, otherwise, it will jump to the last non-empty cell before blank cell. 

     

    Some examples are also provided in http://www.ozgrid.com/VBA/ExcelRanges.htm

     

    Hope this helps. Please let me know if you require something else.

     

    Yury

     

    • Malcolm McMaster's avatar
      Malcolm McMaster
      Copper Contributor

      Many thanks for your response. Problem solved, works like a charm. Great support !

Resources