Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Change Event

Hi,

I'm using a change event to run a routine whenever a specific cell (B3)
changes. That cell uses Excel's data validation tool to restrict the number
of values that can be entered. The change event macro works fine whenever
the user enters a valid value. However, it also runs whenever the user
enters an invalid value and then clicks "Cancel" on the validation tool pop-
up error message. Is there any way to keep the macro from running if the
user attempts to cancel the data entry attempt? Thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Change Event

I don't think you can stop it from running. You probably could check against
the criteria to see whether it is valid or not and only act when it is valid.


--
Regards,
Tom Ogilvy


"cholley via OfficeKB.com" wrote:

Hi,

I'm using a change event to run a routine whenever a specific cell (B3)
changes. That cell uses Excel's data validation tool to restrict the number
of values that can be entered. The change event macro works fine whenever
the user enters a valid value. However, it also runs whenever the user
enters an invalid value and then clicks "Cancel" on the validation tool pop-
up error message. Is there any way to keep the macro from running if the
user attempts to cancel the data entry attempt? Thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Change Event

Hi there,

Check your cell in code against your validation criteria.

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"cholley via OfficeKB.com" <u19904@uwe wrote in message
news:5dfd172cc8f27@uwe...
Hi,

I'm using a change event to run a routine whenever a specific cell (B3)
changes. That cell uses Excel's data validation tool to restrict the
number
of values that can be entered. The change event macro works fine whenever
the user enters a valid value. However, it also runs whenever the user
enters an invalid value and then clicks "Cancel" on the validation tool
pop-
up error message. Is there any way to keep the macro from running if the
user attempts to cancel the data entry attempt? Thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Change Event

You could trap it

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "H1:H20"
Static prevValue

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value < prevValue Then
'do your stuff
prevValue = .Value
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"cholley via OfficeKB.com" <u19904@uwe wrote in message
news:5dfd172cc8f27@uwe...
Hi,

I'm using a change event to run a routine whenever a specific cell (B3)
changes. That cell uses Excel's data validation tool to restrict the

number
of values that can be entered. The change event macro works fine whenever
the user enters a valid value. However, it also runs whenever the user
enters an invalid value and then clicks "Cancel" on the validation tool

pop-
up error message. Is there any way to keep the macro from running if the
user attempts to cancel the data entry attempt? Thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1



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
MsgBox in Enter event causes combobox not to run Change event Richard Excel Programming 0 March 6th 06 02:52 PM
Change event and calculate event Antje Excel Programming 1 March 29th 05 09:03 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM


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