Compile Error... HELP!!!!!

cgibson92

New Member
Joined
May 15, 2015
Messages
8
When new users open the file they receive a "Compile error: Can't find project or library" error. Below is my VBA written to open up a worksheet when the field is selected and and also is a multi select drop down box data validation. Any help would be appreciated....

Also when looking at my script can you help me make the multi select appear in its own cell when selected?

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'Selecting Multiple Values in a Drop Down Box


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

'Opening a Specific Worksheet Depending on What is Selected in the Incentive Type

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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,216,144
Messages
6,129,120
Members
449,488
Latest member
qh017

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