Multi selection to a single cell and in a combined cell

cgibson92

New Member
Joined
May 15, 2015
Messages
8
I need for my multi selection in the data validation list box to populate in the columns to the right in a single cell and still continuing to populating in the same cell. Below is my code any help is appreciated.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String, newVal As String
Dim v As Variant, ws As Worksheet

On Error GoTo exitHandler

If Target.Count > 1 Or Target.Text = "" Then Exit Sub

If Not Intersect(Range("B36,B47"), Target) Is Nothing Then

Application.EnableEvents = False
newVal = Target.Text
Application.Undo
oldVal = Target.Text
Target.value = newVal

If oldVal <> "" Then

If oldVal = newVal Then
Target.value = ""
ElseIf InStr(1, oldVal, newVal) > 0 Then
If Right(oldVal, Len(newVal)) = newVal Then
Target.value = Left(oldVal, Len(oldVal) - Len(newVal) - 1)
Else
Target.value = Replace(oldVal, newVal & Chr(10), "")
End If
Else
Target.value = oldVal & Chr(10) & newVal
End If

End If

Application.ScreenUpdating = False

For Each ws In Sheets(Array("Admin Fee", "Flat Fee", "Market Share", "Override"))
ws.Visible = False
Next ws

For Each v In Array("Admin Fee", "Business Development Bonus ", "Business Development Fee", _
"Flat Fee", "Global Business Development Bonus", "Maintenance Bonus", _
"Override", "Partnership Fee", "Transaction / Service Fee", _
"Select Incentive Type (s)")

If InStr(Target.value, v) Then
Select Case v
Case "Admin Fee", "Transaction / Service Fee"
Sheets("Admin Fee").Visible = True
'Sheets("Admin Fee").Select

Case "Business Development Bonus ", "Flat Fee", "Partnership Fee"
Sheets("Flat Fee").Visible = True
'Sheets("Flat Fee").Select

Case "Business Development Fee", "Override"
Sheets("Override").Visible = True
'Sheets("Override").Select

Case "Global Business Development Bonus", "Maintenance Bonus"
Sheets("Market Share").Visible = True
'Sheets("Market Share").Select

Case "Select Incentive Type (s)"

Case Else

End Select
End If
Next v

End If

exitHandler:
Application.EnableEvents = True
Application.ScreenUpdating = True
If Err.Number <> 0 Then MsgBox Err.Description, vbCritical, "Worksheet_Change Error: " & Err.Number

End Sub


Thanks
Cindy
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,214,965
Messages
6,122,495
Members
449,088
Latest member
Melvetica

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top