How to find or get the cell reference of the previous active cell in Excel?
While working with Microsoft Excel, you may need to know which cell is the previous active cell in current worksheet for some purposes. This article provides a method to get the cell reference of the previous active cell in Excel.
Find or get the cell reference of the previous active cell with VBA code
Find or get the cell reference of the previous active cell with VBA code
You can do as follows to find or get the cell reference of the previous active cell in Excel.
1. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, click Insert > Module. Then copy and paste below VBA code into the Code window. See screenshot:
VBA code: Find and get the cell reference of the previous active cell
Sub LastUsedCell()
Application.ScreenUpdating = False
Application.Volatile
Application.Undo
Application.Undo
Application.ScreenUpdating = True
End Sub
3. Press F5 key to run the code. Then you will locate in the address of the previous active cell in current worksheet immediately.
Note: You can get the cell reference of this cell in the Name box if you need.
Related articles:
- How to find position of first/last number in a text string in Excel?
- How to vlookup find the first, 2nd or nth match value in Excel?
- How to find the closest date to today on a list in Excel?
Best Office Productivity Tools
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day! (Full-Featured 30-Day Free Trial)
