Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I mean put a break in a line of code, select it in the VBIDE and F8(. Then
when it is run, it will stop and you can step through, F8, and see what happens. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "creativeops" wrote in message ... Thanks Bob But what do you mean by "put a break in"? "Bob Phillips" wrote: Nothing jumps out, but a) simplify it (see below), and b) put a break in to see whatr happens. Private Sub Worksheet_Change(ByVal Target As Range) Dim rngDV As Range Dim oldVal As String Dim newVal As String If Target.Count 1 Then GoTo exitHandler On Error Resume Next Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation) On Error GoTo exitHandler If rngDV Is Nothing Then GoTo exitHandler If Not Intersect(Target, rngDV) Is Nothing Then Application.EnableEvents = False newVal = Target.Value Application.Undo oldVal = Target.Value Target.Value = newVal If Target.Column = 8 And Target.Column <= 16 Then If oldVal < "" And newVal < "" Then Target.Value = oldVal & ";" & newVal End If End If End If exitHandler: Application.EnableEvents = True End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "creativeops" wrote in message ... oh - in case it helps, here is the code currently on my tab with the validations. I don't know much about code, but only tinkered with it a little. It was working fine until just today. Anyone see anything in this that would make it unstable? here's the code (from 'view code' after right-clicking the sheet tab): Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim rngDV As Range Dim oldVal As String Dim newVal As String If Target.Count 1 Then GoTo exitHandler On Error Resume Next Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation) On Error GoTo exitHandler If rngDV Is Nothing Then GoTo exitHandler If Intersect(Target, rngDV) Is Nothing Then 'do nothing Else Application.EnableEvents = False newVal = Target.Value Application.Undo oldVal = Target.Value Target.Value = newVal If Target.Column = 8 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If If Target.Column = 9 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If If Target.Column = 11 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If If Target.Column = 12 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If If Target.Column = 13 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If If Target.Column = 14 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If If Target.Column = 15 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If If Target.Column = 16 Then If oldVal = "" Then 'do nothing Else If newVal = "" Then 'do nothing Else Target.Value = oldVal _ & ";" & newVal End If End If End If End If exitHandler: Application.EnableEvents = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to run when validation choice selected | Excel Discussion (Misc queries) | |||
in a data validation list how do i color a choice? | Excel Discussion (Misc queries) | |||
Multiple choice with values | Excel Discussion (Misc queries) | |||
Data Validation (Multiple Choice) | Excel Worksheet Functions | |||
Data Validation: Choice list does not appear | Setting up and Configuration of Excel |