Hi,
I am using data validation to limit the text strings that may be entered into a cell. However one of the options in the data validation list is "OTHER" for things that don't fall under any of the other options. Basically, if the user selects "OTHER" I want an input box to pop up to allow the user to type in a description and it will enter in the cell, "OTHER - user's description".
Here is code that I am using so far which I found online that is allowing more than one entry to be selected in a single cell. I'm not sure how or where in this code to add the code for the input box if "OTHER" is selected. sorry vba n00b. Thanks for any help
I am using data validation to limit the text strings that may be entered into a cell. However one of the options in the data validation list is "OTHER" for things that don't fall under any of the other options. Basically, if the user selects "OTHER" I want an input box to pop up to allow the user to type in a description and it will enter in the cell, "OTHER - user's description".
Here is code that I am using so far which I found online that is allowing more than one entry to be selected in a single cell. I'm not sure how or where in this code to add the code for the input box if "OTHER" is selected. sorry vba n00b. Thanks for any help
Option Explicit
' Developed by Contextures Inc.
' www.contextures.com
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 = 3 Then
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
Target.Value = oldVal _
& Chr(10) & newVal
End If
End If
End If
End If
exitHandler:
Application.EnableEvents = True
End Sub