Results 1 to 15 of 15

Compile Error VBA error code attached

Threaded View

cgibson92 Compile Error VBA error code... 05-28-2015, 11:37 AM
TMS Re: Compile Error... HELP!!!!! 05-28-2015, 11:53 AM
cgibson92 Re: Compile Error... HELP!!!!! 05-28-2015, 12:08 PM
TMS Re: Compile Error... HELP!!!!! 05-28-2015, 01:48 PM
cgibson92 Re: Compile Error... HELP!!!!! 05-28-2015, 02:08 PM
protonLeah Re: Compile Error... HELP!!!!! 05-28-2015, 02:19 PM
TMS Re: Compile Error... HELP!!!!! 05-28-2015, 02:26 PM
cgibson92 Re: Compile Error VBA error... 05-28-2015, 02:42 PM
TMS Re: Compile Error VBA error... 05-28-2015, 02:57 PM
cgibson92 Re: Compile Error VBA error... 05-28-2015, 04:35 PM
TMS Re: Compile Error VBA error... 05-28-2015, 05:40 PM
cgibson92 Re: Compile Error VBA error... 05-29-2015, 10:35 AM
TMS Re: Compile Error VBA error... 05-31-2015, 05:35 PM
cgibson92 Re: Compile Error VBA error... 06-01-2015, 11:06 AM
TMS Re: Compile Error VBA error... 06-01-2015, 11:07 AM
  1. #1
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Compile Error VBA error code attached

    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
    Last edited by cgibson92; 06-01-2015 at 11:04 AM. Reason: title wrong

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  2. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM
  3. [SOLVED] Compile error: Constant expression required error when merging two Codes
    By Kezwick in forum Outlook Programming / VBA / Macros
    Replies: 8
    Last Post: 06-26-2013, 09:32 AM
  4. compile error: compile error expected
    By odeno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2008, 04:30 PM
  5. VBAProject name compile error, not defined at compile time
    By Matthew Dodds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2005, 03:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1