Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I run code when exiting a cell

I want to change the value of certain cells based on the input of another
cell. Looking at other posts, I came up with this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then
Exit Sub
End If
If IsEmpty(Target) Then
Exit Sub
End If
If Target.Address = "$I$12" Then
Select Case Target.Value
Case "VHS"
Range("D27").Select
ActiveCell.FormulaR1C1 = "N/A"
Case "VSS"
Range("F28").Select
ActiveCell.FormulaR1C1 = "N/A"
End Select
End If


The problem is: This code runs when the cell is selected. I need it to run
after the cell is edited, on exit of the cell (another cell selected...).

Please help!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How do I run code when exiting a cell

Hi Roman

There is also a Change event

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

See also
http://www.cpearson.com/excel/events.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Romac Rob" wrote in message ...
I want to change the value of certain cells based on the input of another
cell. Looking at other posts, I came up with this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then
Exit Sub
End If
If IsEmpty(Target) Then
Exit Sub
End If
If Target.Address = "$I$12" Then
Select Case Target.Value
Case "VHS"
Range("D27").Select
ActiveCell.FormulaR1C1 = "N/A"
Case "VSS"
Range("F28").Select
ActiveCell.FormulaR1C1 = "N/A"
End Select
End If


The problem is: This code runs when the cell is selected. I need it to run
after the cell is edited, on exit of the cell (another cell selected...).

Please help!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I run code when exiting a cell

Oh wow, I missed that one! I could make up a million excuses... Bottom line,
your help was greatly appreciated.

thank you very much!

"Ron de Bruin" wrote:

Hi Roman

There is also a Change event

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

See also
http://www.cpearson.com/excel/events.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Romac Rob" wrote in message ...
I want to change the value of certain cells based on the input of another
cell. Looking at other posts, I came up with this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then
Exit Sub
End If
If IsEmpty(Target) Then
Exit Sub
End If
If Target.Address = "$I$12" Then
Select Case Target.Value
Case "VHS"
Range("D27").Select
ActiveCell.FormulaR1C1 = "N/A"
Case "VSS"
Range("F28").Select
ActiveCell.FormulaR1C1 = "N/A"
End Select
End If


The problem is: This code runs when the cell is selected. I need it to run
after the cell is edited, on exit of the cell (another cell selected...).

Please help!





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
Force a comment before exiting a cell Bob Excel Worksheet Functions 1 June 6th 08 05:40 PM
Move cursor to...on exiting cell furnaceman Excel Discussion (Misc queries) 3 June 5th 07 04:00 PM
Calculate Sum in one cell after Exiting (ENTER or TAB) another cel Wayne4js Excel Discussion (Misc queries) 7 December 18th 06 03:56 PM
reight click a cell without exiting from input mode Khoshravan Setting up and Configuration of Excel 2 April 9th 06 01:24 AM
checking for cell value when exiting shikamikamoomoo[_2_] Excel Programming 4 September 22nd 05 08:50 PM


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