![]() |
I need a macro to run when a cells in a specific column ares exited...
So, whenever a user exits a cell in column D, the macro runs. I' currently using Worksheet.SelectionChange, but this runs whenever AN cell is exited. Any ideas -- madblok ----------------------------------------------------------------------- madbloke's Profile: http://www.excelforum.com/member.php...fo&userid=1442 View this thread: http://www.excelforum.com/showthread.php?threadid=46814 |
I need a macro to run when a cells in a specific column ares exited...
Hi MadBloke,
Try replacing your existing Worksheet_SelectionChange procedure with: '=================== Option Explicit Private col As Long <<=== At top of worksheet module '--------------------------------- Private Sub Worksheet_Activate() Set rngOld = ActiveCell.Column End Sub '--------------------------------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) Const MyCol As Long = 4 'Column "D" If Target.Column = MyCol Then col = 4 Exit Sub End If If col = MyCol Then 'User has exited column "D" 'Do something, e.g.: MsgBox "You have exited column D" End If col = Target.Column End Sub '<<=================== --- Regards, Norman "madbloke" wrote in message ... So, whenever a user exits a cell in column D, the macro runs. I'm currently using Worksheet.SelectionChange, but this runs whenever ANY cell is exited. Any ideas? -- madbloke ------------------------------------------------------------------------ madbloke's Profile: http://www.excelforum.com/member.php...o&userid=14422 View this thread: http://www.excelforum.com/showthread...hreadid=468148 |
I need a macro to run when a cells in a specific column ares exited...
That kind of worked. Basically, what I'm trying to do is when someone types their name into a cell in Column D, to search through a list on another sheet, and auto-fill in other details for them (staff number etc). Currently, it works, but only if the user types their name and then presses Return (I'm using Offset (-1, 0) to get the user input). What I need is to capture the user's input into Column D regardless of whether they press Return, Tab, or click out of the column. Any ideas? -- madbloke ------------------------------------------------------------------------ madbloke's Profile: http://www.excelforum.com/member.php...o&userid=14422 View this thread: http://www.excelforum.com/showthread...hreadid=468148 |
All times are GMT +1. The time now is 05:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com