PC Review


Reply
Thread Tools Rate Thread

Cells or Range ? LostFocus

 
 
LRay67
Guest
Posts: n/a
 
      31st Mar 2008
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
 
Reply With Quote
 
 
 
 
Ivyleaf
Guest
Posts: n/a
 
      31st Mar 2008
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 <LRa...@discussions.microsoft.com> 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


 
Reply With Quote
 
Ivyleaf
Guest
Posts: n/a
 
      31st Mar 2008
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 <ica...@gmail.com> 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 <LRa...@discussions.microsoft.com> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
change colors in a range of excel cells based on another range of cells Bobbi Muck Microsoft Excel Programming 1 9th Apr 2010 03:47 AM
how to compute a range of cells based on another range of cells? =?Utf-8?B?SEFST0xE?= Microsoft Excel Worksheet Functions 1 30th Dec 2005 09:32 PM
how to compute a range of cells based on another range of cells? =?Utf-8?B?SEFST0xE?= Microsoft Excel Worksheet Functions 2 30th Dec 2005 07:55 PM
Copy a formula to a range of cells via VB6 using .Range(Cells(row,col), Cells(row,col)).Formula= statement Kevin Microsoft Excel Programming 7 5th Oct 2004 08:11 PM
defining an event procedure (lostfocus) that works on a column range juhlott Microsoft Excel Programming 1 8th Jul 2004 08:26 PM


Features
 

Advertising
 

Newsgroups
 


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