#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default vba event

Hello

I've created a cell that has a validation list associated to it. Which Event can I use so that it will run that event when and only when that validation range is modified

Currently I've have the macro in the sheet_change section but this mean that it run whenever any change occurs on the sheet and this is useless. I only need it to run if the selection from the validation range change

Thank you for your help

Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default vba event

Hi Daniel
use the worksheet change event and restrict the range it should
process. e.g.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A10")) Is Nothing Then Exit Sub
'your code

End Sub

your code is only processed if a single cell in the range A1:A10 is
changed


--
Regards
Frank Kabel
Frankfurt, Germany

Daniel P wrote:
Hello,

I've created a cell that has a validation list associated to it.
Which Event can I use so that it will run that event when and only
when that validation range is modified?

Currently I've have the macro in the sheet_change section but this
mean that it run whenever any change occurs on the sheet and this is
useless. I only need it to run if the selection from the validation
range changes

Thank you for your help,

Daniel


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default vba event

If Target.Cells.Count 1 Then Exit Sub

So, Frank, if the user selects 2 or more cells in the validation range and
makes a (Ctrl-Enter) change the validation routine is bypassed?<g

--
Jim Rech
Excel MVP


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default vba event

Hi Jim
yes, as I wrote :-)
....if a SINGLE cell in ....

But you're right the OP should probably delete this line

--
Regards
Frank Kabel
Frankfurt, Germany

Jim Rech wrote:
If Target.Cells.Count 1 Then Exit Sub


So, Frank, if the user selects 2 or more cells in the validation
range and makes a (Ctrl-Enter) change the validation routine is
bypassed?<g

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default vba event

Hi Daniel
good to hear it works for you :-)

--
Regards
Frank Kabel
Frankfurt, Germany

Daniel P wrote:
Thank you very much for your help!

Daniel

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
event vba irosh Excel Worksheet Functions 4 November 11th 08 09:25 AM
VBA Event Steve Excel Discussion (Misc queries) 2 October 14th 08 11:04 PM
event marker68 Excel Discussion (Misc queries) 1 April 4th 08 02:38 PM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


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