I have 2 VBA codes that i would like both to run when making a selection from a data validation drop down box. Could you please help me incorporate both so they will work.
This code will let me select more than one item in a data validation drop down box.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String, newVal As String
On Error GoTo exitHandler
If Target.Count > 1 Or Target.Text = "" Then Exit Sub
If Intersect(Range("B36,B44"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
newVal = Target.Text
Application.Undo
oldVal = Target.Text
Target.value = newVal
If oldVal = "" Then GoTo exitHandler
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
exitHandler:
Application.EnableEvents = True
End Sub
And this code will open a worksheet when it is selected in the data validation drop down box.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value = "Admin Fee" Then
Sheets("Admin Fee").Visible = True
Sheets("Admin Fee").Select
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Business Development Bonus" Then
Sheets("Flat Fee").Visible = True
Sheets("Flat Fee").Select
Sheets("Admin Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Business Development Fee" Then
Sheets("Override").Visible = True
Sheets("Override").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
ElseIf Target.Value = "Flat Fee" Then
Sheets("Flat Fee").Visible = True
Sheets("Flat Fee").Select
Sheets("Admin Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Global Business Development Bonus" Then
Sheets("Market Share").Visible = True
Sheets("Market Share").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Maintenance Bonus" Then
Sheets("Market Share").Visible = True
Sheets("Market Share").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Override" Then
Sheets("Override").Visible = True
Sheets("Override").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
ElseIf Target.Value = "Partnership Fee" Then
Sheets("Flat Fee").Visible = True
Sheets("Flat Fee").Select
Sheets("Admin Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Transaction / Service Fee" Then
Sheets("Admin Fee").Visible = True
Sheets("Admin Fee").Select
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Select Incentive Type (s)" Then
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
End If
End Sub
Thanks
This code will let me select more than one item in a data validation drop down box.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String, newVal As String
On Error GoTo exitHandler
If Target.Count > 1 Or Target.Text = "" Then Exit Sub
If Intersect(Range("B36,B44"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
newVal = Target.Text
Application.Undo
oldVal = Target.Text
Target.value = newVal
If oldVal = "" Then GoTo exitHandler
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
exitHandler:
Application.EnableEvents = True
End Sub
And this code will open a worksheet when it is selected in the data validation drop down box.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value = "Admin Fee" Then
Sheets("Admin Fee").Visible = True
Sheets("Admin Fee").Select
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Business Development Bonus" Then
Sheets("Flat Fee").Visible = True
Sheets("Flat Fee").Select
Sheets("Admin Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Business Development Fee" Then
Sheets("Override").Visible = True
Sheets("Override").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
ElseIf Target.Value = "Flat Fee" Then
Sheets("Flat Fee").Visible = True
Sheets("Flat Fee").Select
Sheets("Admin Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Global Business Development Bonus" Then
Sheets("Market Share").Visible = True
Sheets("Market Share").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Maintenance Bonus" Then
Sheets("Market Share").Visible = True
Sheets("Market Share").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Override" Then
Sheets("Override").Visible = True
Sheets("Override").Select
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
ElseIf Target.Value = "Partnership Fee" Then
Sheets("Flat Fee").Visible = True
Sheets("Flat Fee").Select
Sheets("Admin Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Transaction / Service Fee" Then
Sheets("Admin Fee").Visible = True
Sheets("Admin Fee").Select
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
ElseIf Target.Value = "Select Incentive Type (s)" Then
Sheets("Admin Fee").Visible = False
Sheets("Flat Fee").Visible = False
Sheets("Market Share").Visible = False
Sheets("Override").Visible = False
End If
End Sub
Thanks