Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Last ActiveCell

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

Thank you,

Steven
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Last ActiveCell

Ctrl-Z will take you back there.

--
__________________________________
HTH

Bob

"Steven" wrote in message
...
When you change cells is there a way to tell which was the last active
cell.

Thank you,

Steven



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Last ActiveCell

hi
excel doesn't remember last cells but you can do it with variables.
dim r as range
range("A1").select
set r = activecell
range("B9").select 'A1 was last activecell
set r = activecell 'now B9 is last activecell.

you can set varaibles for last sheet also so as to return to a point(sheet
and cell) after going off to do other stuff.

regards
FSt1

regards
FSt1


"Steven" wrote:

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

Thank you,

Steven

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Last ActiveCell

Put this in the ThisWorkBook module:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim LastCell As String
LastCell = Cells(Target.Row, Target.Column).Address
End Sub



"Steven" wrote:

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

Thank you,

Steven

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Last ActiveCell

Bob
Is there some reference that has to be active for this Ctrl-Z to work?
I have 2002 and Ctrl-Z doesn't do anything for me. Thanks for your time.
Otto
"Bob Phillips" wrote in message
...
Ctrl-Z will take you back there.

--
__________________________________
HTH

Bob

"Steven" wrote in message
...
When you change cells is there a way to tell which was the last active
cell.

Thank you,

Steven






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Last ActiveCell

Kent
What does do this do toward finding the previous cell? Otto
"Kent Prokopy" wrote in message
...
Put this in the ThisWorkBook module:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Dim LastCell As String
LastCell = Cells(Target.Row, Target.Column).Address
End Sub



"Steven" wrote:

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

Thank you,

Steven


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Last ActiveCell

Ctrl-z is Undo.

--
Jim
"Otto Moehrbach" wrote in message
...
| Bob
| Is there some reference that has to be active for this Ctrl-Z to work?
| I have 2002 and Ctrl-Z doesn't do anything for me. Thanks for your time.
| Otto
| "Bob Phillips" wrote in message
| ...
| Ctrl-Z will take you back there.
|
| --
| __________________________________
| HTH
|
| Bob
|
| "Steven" wrote in message
| ...
| When you change cells is there a way to tell which was the last active
| cell.
|
| Thank you,
|
| Steven
|
|
|

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Last ActiveCell

Jim
Maybe I just missed something, but the OP was asking how to find the
previously selected cell, and a selection change does not get into the Undo
buffer. Hitting Undo will take him back to the previous cell only if he
changed the contents of that cell. What did I miss? Otto
"Jim Rech" wrote in message
...
Ctrl-z is Undo.

--
Jim
"Otto Moehrbach" wrote in message
...
| Bob
| Is there some reference that has to be active for this Ctrl-Z to
work?
| I have 2002 and Ctrl-Z doesn't do anything for me. Thanks for your
time.
| Otto
| "Bob Phillips" wrote in message
| ...
| Ctrl-Z will take you back there.
|
| --
| __________________________________
| HTH
|
| Bob
|
| "Steven" wrote in message
| ...
| When you change cells is there a way to tell which was the last
active
| cell.
|
| Thank you,
|
| Steven
|
|
|


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Last ActiveCell

You interpreted his "last activecell" as "previously selected cell". Just
as valid is the last active cell in the sheet (gotten to via {End}{Home}).
However I was just saying what Ctrl-z was since I thought you were asking.
I have no opinion on the efficacy of Bob's suggestion<g.

--
Jim
"Otto Moehrbach" wrote in message
...
| Jim
| Maybe I just missed something, but the OP was asking how to find the
| previously selected cell, and a selection change does not get into the
Undo
| buffer. Hitting Undo will take him back to the previous cell only if he
| changed the contents of that cell. What did I miss? Otto
| "Jim Rech" wrote in message
| ...
| Ctrl-z is Undo.
|
| --
| Jim
| "Otto Moehrbach" wrote in message
| ...
| | Bob
| | Is there some reference that has to be active for this Ctrl-Z to
| work?
| | I have 2002 and Ctrl-Z doesn't do anything for me. Thanks for your
| time.
| | Otto
| | "Bob Phillips" wrote in message
| | ...
| | Ctrl-Z will take you back there.
| |
| | --
| | __________________________________
| | HTH
| |
| | Bob
| |
| | "Steven" wrote in message
| | ...
| | When you change cells is there a way to tell which was the last
| active
| | cell.
| |
| | Thank you,
| |
| | Steven
| |
| |
| |
|
|

  #10   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
How to Revert to ActiveCell.Formula = format from ActiveCell.FormulaR1C1 = format Karthik Bhat - Bangalore[_2_] Excel Programming 1 May 9th 07 02:37 PM
ActiveCell Esau[_3_] Excel Programming 2 April 21st 07 03:04 PM
IF Activecell Rewop Eilsel[_2_] Excel Programming 2 October 18th 06 02:52 PM
if activecell is value רוזנט Excel Programming 4 July 11th 06 08:19 PM


All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"