LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Did LostFocus ever exist or is just a dream?!


Hi all,
I get stuck again in macro in Excel...What I need is fairly simple:
Immediately after a cell, say C6, lost focus, a corresponding cell, say
C12 is getting updated with the same/new value as C6. I tried to use
SelectionChange as follows:

Public Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim RNQVal As Integer
Dim RowVal As Integer
Dim ColVal As Integer

' Now get the row, column number and the value of the RNQ cell
(analogous to C6 in the description)
RowVal = Target.Row
ColVal = Target.Column

If (ColVal = 7 And RowVal 25) Then
' validate the value just entered into the cell
RNQVal = Target.Value

' Set the corresponding DNQ cell(analogous to C12 in the
description) with the same value
Cells(RowVal, ColVal + 6).Locked = False
Cells(RowVal, ColVal + 6).Value = RNQVal
Cells(RowVal, ColVal + 6).Locked = True

End If
End Sub

But the above code snippet does not do exactly as expected. It does NOT
update C12 immediately after moving the cursor from C6, but does so when
C6 regains the focus afterwards. I searched the Internet almost for the
whole day trying to get through, but I just cannot!! There's no helpful
information at all on LostFocus, though it seems like what I need. I
could not even find any code sample on LostFocus either
....Any help would be highly appreciated. Thanks in advance!!


--
uglyvb
------------------------------------------------------------------------
uglyvb's Profile: http://www.excelforum.com/member.php...o&userid=31720
View this thread: http://www.excelforum.com/showthread...hreadid=514282

 
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
uk lotto dream numbers DarkNight New Users to Excel 8 October 30th 06 05:43 AM
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
how do i do a dream team bobby New Users to Excel 1 August 13th 05 11:50 PM


All times are GMT +1. The time now is 12:35 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"