Thread: Last ActiveCell
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
BillCPA BillCPA is offline
external usenet poster
 
Posts: 101
Default Last ActiveCell

Not sure who Otto and Jim are or why they are so combative.

I was looking for the same thing today and came across your question.
Kent's idea is pretty close, and I worked from that. Here is what I ended up
with.

Define a couple of Public strings: ThisCell and LastCell. Then in your
Sheet Module, put this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

LastCell = ThisCell
ThisCell = ActiveCell.Address

End Sub

You may also want to initialize ThisCell in the Workbook_Open module.

Then each time you move to a different cell, LastCell will give you the cell
address of the previous cell.

--
Bill @ UAMS


"Steven" wrote:

When you change cells is there a way to tell which was the last active cell.

Thank you,

Steven