Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Find previous active cell

Excel XP & Win XP
Is there a way to find the previous active cell? I want to use a
Worksheet_SelectionChange event macro to fire when a selection change is
made and then I want that macro to tell me the previous active cell. My end
goal is to force a tab sequence in a group of cells even when a cell entry
is not made. Thanks for your time. Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Find previous active cell

Perhaps something like this embedded directly in the sheet...

Private Sub Worksheet_Activate()
MsgBox "Current Address " & ActiveCell.Address
MsgBox "Last address " & LastCell.Address
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox "Current Address " & Target.Address
MsgBox "Last address " & LastCell.Address
End Sub

Private Function LastCell() As Range
Static rngLastCell As Range

If rngLastCell Is Nothing Then Set rngLastCell = ActiveCell
Set LastCell = rngLastCell
Set rngLastCell = ActiveCell
End Function
--
HTH...

Jim Thomlinson


"Otto Moehrbach" wrote:

Excel XP & Win XP
Is there a way to find the previous active cell? I want to use a
Worksheet_SelectionChange event macro to fire when a selection change is
made and then I want that macro to tell me the previous active cell. My end
goal is to force a tab sequence in a group of cells even when a cell entry
is not made. Thanks for your time. Otto



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
Previous active cell Steven Excel Programming 2 April 24th 08 12:41 AM
Find cell address of previous active cell Google Excel Excel Programming 1 November 21st 06 12:14 AM
Find first previous cell with data Nancy Newburger New Users to Excel 3 August 10th 06 09:10 PM
how to compare the active cell value to the previous cell's value crimsonkng Excel Programming 2 December 5th 05 03:19 PM
Previous active cell MVM Excel Programming 3 January 2nd 05 10:29 PM


All times are GMT +1. The time now is 03:44 AM.

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"