LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default multiple choice data validation

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
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 to run when validation choice selected JDay01 Excel Discussion (Misc queries) 3 December 20th 06 08:21 PM
in a data validation list how do i color a choice? Sam Excel Discussion (Misc queries) 6 July 13th 06 02:14 AM
Multiple choice with values awilliams Excel Discussion (Misc queries) 0 January 25th 06 11:07 PM
Data Validation (Multiple Choice) John Jost Excel Worksheet Functions 4 December 13th 05 01:45 PM
Data Validation: Choice list does not appear Elodie Setting up and Configuration of Excel 3 November 23rd 05 11:06 PM


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