Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Cells or Range ? LostFocus

Can cells or ranges have a LostFocus function behind it? If not LostFocus is
there something that is compatible with this function for Cells or Ranges?

Thanks

Linda
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Cells or Range ? LostFocus

Hi Linda,

To my understanding 'Worksheet_SelectionChange' or
'Workbook_SheetSelectionChange' are about as close as it gets, but
'Target' will be the cell / range you are moving to not the one you
have left.

Cheers,
Ivan.

On Apr 1, 12:54*am, LRay67 wrote:
Can cells or ranges have a LostFocus function behind it? *If not LostFocus is
there something that is compatible with this function for Cells or Ranges?

Thanks

Linda


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Cells or Range ? LostFocus

Hi again,

There are probably other ways to do this (usually are), but you could
try defining a global variable and keeping that up to date with the
active range / cell. Here's an example which you would pop in the
ThisWorkbook module or a sheet module with the correct modifications:

Private ExitRng As Range, ExitCell As Range

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
Dim a As String
If Not ExitRng Is Nothing Then
msg = "You just left range " & ExitRng.Address
msg = msg & " that had cell " & ExitCell.Address & " active"
msg = msg & vbCr & " and you have gone to " & Target.Address
msg = msg & " with the active cell being " &
ActiveCell.Address
MsgBox msg
End If
Set ExitRng = Target
Set ExitCell = ActiveCell
End Sub

Cheers,
Ivan.

On Apr 1, 1:10*am, Ivyleaf wrote:
Hi Linda,

To my understanding 'Worksheet_SelectionChange' or
'Workbook_SheetSelectionChange' are about as close as it gets, but
'Target' will be the cell / range you are moving to not the one you
have left.

Cheers,
Ivan.

On Apr 1, 12:54*am, LRay67 wrote:



Can cells or ranges have a LostFocus function behind it? *If not LostFocus is
there something that is compatible with this function for Cells or Ranges?


Thanks


Linda- Hide quoted text -


- Show quoted text -


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
Did LostFocus ever exist or is just a dream?! uglyvb Excel Programming 7 February 22nd 06 10:59 PM
deactivate macro or LostFocus Harold Good Excel Programming 8 January 17th 06 06:01 PM
action on lostfocus in a cell Einar[_2_] Excel Programming 3 October 18th 05 04:55 PM
defining an event procedure (lostfocus) that works on a column range juhlott Excel Programming 1 July 8th 04 08:26 PM


All times are GMT +1. The time now is 09:51 PM.

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

About Us

"It's about Microsoft Excel"