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
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.
- 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
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!