Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default action on lostfocus in a cell

Hi NG

I've tried to make a Excel VBA macro to take the value from a cell - cell
M3 - when focus is leaving that cell, but I'm not able to do that :-(

Any one in here, who can help me plz




  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default action on lostfocus in a cell

You'll probably need to use the selectionChange event in the worksheet. I
don't know how to check if M3 was active before the selection change.

You could try something like:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("M3").copy
Range("A1").PasteSpecial
Application.CutCopyMode = False
End Sub

"Einar" wrote:

Hi NG

I've tried to make a Excel VBA macro to take the value from a cell - cell
M3 - when focus is leaving that cell, but I'm not able to do that :-(

Any one in here, who can help me plz





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default action on lostfocus in a cell

Hi to all

This is a step in correct direction.

Try this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static oldRange As Range
If Not oldRange Is Nothing Then
If oldRange.Address = "$M$3" Then
MsgBox "Do your stuff"
End If
End If
Set oldRange = Target
End Sub

Hoop that helps,


Wouter

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default action on lostfocus in a cell

"Executor" skrev i en meddelelse
oups.com...
Hi to all

This is a step in correct direction.

Try this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static oldRange As Range
If Not oldRange Is Nothing Then
If oldRange.Address = "$M$3" Then
MsgBox "Do your stuff"
End If
End If
Set oldRange = Target
End Sub

Hoop that helps,


Wouter


Exatly what I needed - after I discovered that it not was in module, but
in
sheet (ark in danish) I should put it.

Tnx



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
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
action on cell activate KimR.Hammel[_2_] Excel Programming 1 September 15th 05 08:16 PM
Action after Activate a cell tang lk[_2_] Excel Programming 2 April 10th 05 12:24 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 05:11 AM.

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"