LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default VBA code silently crashing. Problem with Data Validation drop down lists.

One of the things I dislike is when Excel VBA silently crashes and doesn't
return a debug message box. You can step through and find the bad line, but
that doesn't help you determine why the line fails.

In this routine, without the On Error line, it will silently fail on any of
the Target.Offset(0, 1).Value = lines. With the error trapping at least it
does know that there was an error, so my EnableEvents is restored.

Target.Offset(0, 1).Address is a Data Validation drop down list. The values
I'm trying to assign to the cells are valid entries. (Target.Address is
also a Data Validation drop down list.)

This is not the first time I've had problems with changes in Data
Validation drop down lists cells changing other Data Validation drop down
lists. I'm using XL2002.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

On Error GoTo ErrorSection

If Not Intersect(Range("TermsLinked"), Target) Is Nothing Then
Application.EnableEvents = False
If Target.Value = "Not Covered" Then
Target.Offset(0, 1).Value = "Follow Form"
ElseIf Target.Value = "Covered" Then
Target.Offset(0, 1).Value = "Excluded"
End If
ElseIf Target.Address = Range("TermsWC").Cells(10, 1).Address Then
Application.EnableEvents = False
If Target.Value = "No Exposure" Then
Target.Offset(0, 1).Value = "No Exposure"
ElseIf Target.Value = "Exposure" Then
Target.Offset(0, 1).Value = "Excluded"
End If
End If

ErrorSection:
Application.EnableEvents = True

End Sub

Don <donwiss at panix.com.
 
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
Data Validation & Drop-Down Lists fly61265 Excel Discussion (Misc queries) 4 June 3rd 09 04:12 PM
Data validation or drop down lists wew Excel Discussion (Misc queries) 4 August 18th 08 03:56 PM
Excel Silently Crashing when Network file is open Scot McPherson Excel Discussion (Misc queries) 3 January 2nd 08 05:51 PM
data validation and drop down lists LewR Excel Discussion (Misc queries) 3 March 14th 06 06:50 PM
data validation - Drop Down Lists Annie Excel Discussion (Misc queries) 8 July 29th 05 01:03 AM


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