Forum Discussion
Malcolm McMaster
May 29, 2017Copper Contributor
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 SubThis 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 TokarevSteel 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 SubThis 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 McMasterCopper Contributor
Many thanks for your response. Problem solved, works like a charm. Great support !