Compile Issue

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
771
Office Version
  1. 365
Platform
  1. Windows
HELP,

I have an issue with the following code,
I keep getting "Compile Error, Can't find project or library"
I am runnning this as a shared file for work and i have been creating this for about 2 weeks. Hopefully this will be the last fault

Cheers


Rich (BB code):
Private Sub cmdsubmit_Click()
 
'Open file
Dim gotcha As Boolean
'Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\Data.xls" 'Home
Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Gavin Mazza\Car Park\Data.xls"
Dim myBook As Workbook
 
On Error Resume Next
Set myBook = Application.Workbooks("Data1.xls")
On Error GoTo 0
 
'If Ash Longman - Call Centre Enquiry
Dim iRow As Long
Dim ws As Worksheet
Dim lRow As Integer
Set ws = Worksheets("Ashley Longman")
If UserForm2.ComboBox1 = "Ashley Longman" Then
    Pword = InputBox("Please enter password")
    If Pword = "ticket" Then
    ActiveWorkbook.Sheets("Ashley Longman").Activate
 
    End If
 
    Unload Me
     lRow = Range("N" & Rows.Count).End(xlUp).Row + 1
     For i = 3 To lRow
        If Cells(i, 1).Value = "" Then Exit For
        If Cells(i, 1).Value <> "" And Cells(i, 14).Value = "" Then
     'For i = 5 To 65000 'OLD CODE REPLACED WITH ABOVE
        'If Cells(i, 1) = "" Then Exit For 'OLD CODE REPLACED WITH ABOVE
        'If Cells(i, 1) <> "" And Cells(i, 14) = "" Then 'OLD CODE REPLACED WITH ABOVE
            gotcha = True
            UserForm1.Show False 'DEBUGS @ THIS POINT AND I DONT KNOW WHY
            UserForm1.txtdate.Value = Cells(i, 1)
            UserForm1.TextBox1.Value = Cells(i, 3)
            UserForm1.TextBox13.Value = Cells(i, 2)
            UserForm1.TextBox2.Value = Cells(i, 4)
            UserForm1.TextBox3.Value = Cells(i, 7)
            UserForm1.TextBox6.Value = Cells(i, 5)
            UserForm1.TextBox5.Value = Cells(i, 6)
            UserForm1.TextBox4.Value = Cells(i, 8)
            UserForm1.TextBox7.Value = Cells(i, 9)
            UserForm1.TextBox8.Value = Cells(i, 10)
            UserForm1.TextBox9.Value = Cells(i, 13)
            UserForm1.TextBox14.Value = Cells(i, 11)
            UserForm1.TextBox15.Value = Cells(i, 12)
            UserForm1.TextBox11.Value = Cells(i, 4)
 
 
            With UserForm1.CBoxAdd
                 .AddItem "Ash Young"
                 .AddItem "Chris Holcombe"
                 .AddItem "Chris Nash"
                 .AddItem "David Watson"
                 .AddItem "Gary Littler"
                 .AddItem "Kris Harwood"
                 .AddItem "Michelle Porter"
                 .AddItem "Tim Nickson"
                 .AddItem "Zenny Asghar"
             End With
 
             With UserForm1.txtdate
                 .Enabled = False
             End With
 
        End If
    Next
 
    If gotcha = False Then
        MsgBox "Nothing to Update"
 
        ActiveWindow.Close (True)
 
End If
 
End If
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
this error efton refers to a missing activex component.

have a look at Tools>References
and see if there is something ticked with (missing) next to it
untick and should be OK
 
Upvote 0
Many Thanks that was spot on.

Any ideas why VB would debug on the lines below as this previously worked?

lRow = Range("N" & Rows.Count).End(xlUp).Row + 1<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
For i = 3 To lRow<o:p></o:p>
If Cells(i, 1).Value = "" Then Exit For<o:p></o:p>
If Cells(i, 1).Value <> "" And Cells(i, 14).Value = "" Then<o:p></o:p>
gotcha = True<o:p></o:p>
UserForm1.Show False<o:p></o:p>
Cheers
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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