Previous active cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to find the location of the previous activecell?
Appreciate the help.
MVM
 
Hi
one brute-force way would be to use the SelectionChange event to store the
old active cell in a static variable. what are you trying to do with this
information
 
Like, if user moves from G6 to L8, you want to return a reference to
G6? You'll have to carry the reference along either in a hidden
sheet or in a variable with scope outside of a subroutine. Example:

Option Explicit

Dim sCurrentAddress As String
Dim sOldAddress As String

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
sOldAddress = sCurrentAddress
sCurrentAddress = Target.Address
MsgBox "From " & sOldAddress
End Sub

Ray at work
 
Thank you.
I have two columns, say C & D.
if user enters in D and C is empty, I display a message and move the active
cell in C (same row). when user enters a value in C and then enters in D and
hit RETURN key, I don't want to display the message, simply move to next row
C.

how to find I hit RETURN?
or the previous cell is in D?

is there any way to display a tool tip when user moves to column D with
empty C?

Thanks
MVM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top