Find cell address of previous active cell
This method works on the second and subsequent cursor movement but
obviously not on the first cursor movement since prevTarget and
currTarget are initially null. Any ideas on how to capture the
previous active cell on the first cursor movement?
Mike Woodhouse wrote:
I can only think of tracking SelectionChange events. Try putting this
in your worksheet's Module:
Option Explicit
Dim prevTarget As Range
Dim currTarget As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next ' Lazy workaround for empty objects first time through
Set prevTarget = currTarget
Set currTarget = Target
Debug.Print "Now at " & currTarget.Address & ", previously at " & prevTarget.Address
On Error GoTo 0
End Sub
|