Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

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
Macro from cell specific to whole column Bean Counter[_2_] Excel Discussion (Misc queries) 4 May 27th 10 11:04 PM
Macro running when a cell is exited Daniel Lees Excel Discussion (Misc queries) 1 July 20th 05 02:45 PM
Excel Macro Query - Search for specific text in cells of a column Mcneilius Excel Programming 2 August 29th 04 05:12 PM
Apply Macro to Specific Column Frank Kabel Excel Programming 1 May 12th 04 08:46 PM
Apply Macro to Specific Column Dick Kusleika[_3_] Excel Programming 0 May 12th 04 08:40 PM


All times are GMT +1. The time now is 09:47 AM.

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"