Can't find project or library

chngbh

New Member
Joined
Sep 27, 2016
Messages
2
I have excel (xls) file with macro and works properly with errors. The weird part happen next.
:warning:At the same time, I'd created a new excel file and each cell with confirmed text will prompt me an error "Can't find project or library".

I'd checked through Tools/References and can't find any missing library files.

I even tested on the another machines and re-install the Ms Office, the problem still exists.

Did anyone of you encountered this?:eeek::eeek::confused:
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
can you post the macro code?
 
Upvote 0
Below is my macro code and I'm still doubt what causing the error to prompt.
[ code ]
Public Function Claimed(QC, YA, OldRate, NewRate)


Application.Volatile True


'To find numeric AA and IA for special rates
''If IsNumeric(OldRate) = False Then
'' OldRate1 = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 2, False)
'' IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
''Else
'' OldRate1 = OldRate
'' IARate = 0.2
''End If
''If IsNumeric(NewRate) = False Then
'' NewRate1 = Application.WorksheetFunction.VLookup(NewRate, Range("SRate"), 2, False)
'' IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
''Else
'' NewRate1 = NewRate
''End If

If Len(YA) = 0 And Len(NewRate) = 0 Then Exit Function

If IsNumeric(OldRate) = False Then
OldRate1 = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 2, False)
IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
ElseIf YA = Sheet2.Range("C4") And ((OldRate1 = 100 And NewRate1 = 100)) Then
OldRate1 = OldRate
IARate = 0
ElseIf YA = Sheet2.Range("C4") And (OldRate1 = 50 And NewRate1 = 50) Then
OldRate1 = OldRate
IARate = 0
ElseIf YA <> Sheet2.Range("C4") And (OldRate1 = 50 And NewRate1 = 50) Then
OldRate1 = OldRate
IARate = 0
Else
OldRate1 = OldRate
IARate = 0.2
End If
If IsNumeric(NewRate) = False Then
NewRate1 = Application.WorksheetFunction.VLookup(NewRate, Range("SRate"), 2, False)
IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
ElseIf OldRate = 100 And NewRate = 100 Then
NewRate1 = NewRate
IARate = 0
ElseIf OldRate = 50 And NewRate = 50 Then
NewRate1 = NewRate
IARate = 0
ElseIf YA <> Sheet2.Range("C4") And (OldRate = 50 And NewRate = 50) Then
NewRate1 = NewRate
IARate = 0
Else
NewRate1 = NewRate
End If

'IA rate for IBA
If OldRate1 = 2 Or NewRate1 = 2 Or OldRate1 = 3 Or NewRate1 = 3 Then IARate = 0.1

'Lookup no. years allowance was claimed
If IsNumeric(YA) = True Then
If YA < 1950 Then
If YA <= 1 Then
NumYr = 0
Else
NumYr = 50 'To restrict no. of years allowance was claimed
End If
Else
NumYr = Application.WorksheetFunction.VLookup(YA, Range("YA_Tbl"), 2, False)
End If
Else
NumYr = Application.WorksheetFunction.VLookup(YA, Range("YA_Tbl"), 2, False)
End If

'Lookup no. years to 2000CYB
CYBYr = Application.WorksheetFunction.VLookup("2000C", Range("YA_Tbl"), 2, False)
'Lookup no. years to YA2002
NumYrB = Range("YrYA2002").Value

'To compute total % of AA claimed
If NewRate1 = 3 And OldRate = 2 Then
NewClaim = NewRate1 / 100 * NumYrB
OldClaim = OldRate1 / 100 * (NumYr - NumYrB)
ElseIf NewRate1 > 0 Then 'If NewRate is present
NewClaim = NewRate1 / 100 * CYBYr
OldClaim = OldRate1 / 100 * (NumYr - CYBYr)
Else
NewClaim = 0
OldClaim = OldRate1 / 100 * NumYr
End If

'TotalClaim = Round((NewClaim + OldClaim + IARate) * QC, 0)
If YA = Sheet2.Range("C4") And (OldRate = "A10" And NewRate = "A10") Then
TotalClaim = Round((0.1) * QC, 0)
ElseIf YA = Sheet2.Range("C4") And (OldRate = "A20" And NewRate = "A20") Then
TotalClaim = Round((0.2) * QC, 0)
ElseIf YA = Sheet2.Range("C4") And (OldRate = "A50" And NewRate = "A50") Then
TotalClaim = Round((0.5) * QC, 0)
ElseIf YA = Sheet2.Range("C4") And (OldRate = 100 And NewRate = 100) Then
TotalClaim = 0
ElseIf YA = Sheet2.Range("C4") And (OldRate = 50 And NewRate = 50) Then
TotalClaim = 0
Else
TotalClaim = Round((NewClaim + OldClaim + IARate) * QC, 0)
End If
Claimed = Application.WorksheetFunction.Min(TotalClaim, QC)
End Function
[ /code ]
 
Upvote 0
Below is my macro code and I'm still doubt what causing the error to prompt.
Code:
Public Function Claimed(QC, YA, OldRate, NewRate)


Application.Volatile True


'To find numeric AA and IA for special rates
    ''If IsNumeric(OldRate) = False Then
    ''    OldRate1 = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 2, False)
    ''    IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
    ''Else
    ''    OldRate1 = OldRate
    ''    IARate = 0.2
    ''End If
    ''If IsNumeric(NewRate) = False Then
    ''    NewRate1 = Application.WorksheetFunction.VLookup(NewRate, Range("SRate"), 2, False)
    ''    IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
    ''Else
    ''    NewRate1 = NewRate
    ''End If
    
    If Len(YA) = 0 And Len(NewRate) = 0 Then Exit Function
    
    If IsNumeric(OldRate) = False Then
        OldRate1 = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 2, False)
        IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
    ElseIf YA = Sheet2.Range("C4") And ((OldRate1 = 100 And NewRate1 = 100)) Then
        OldRate1 = OldRate
        IARate = 0
    ElseIf YA = Sheet2.Range("C4") And (OldRate1 = 50 And NewRate1 = 50) Then
        OldRate1 = OldRate
        IARate = 0
    ElseIf YA <> Sheet2.Range("C4") And (OldRate1 = 50 And NewRate1 = 50) Then
        OldRate1 = OldRate
        IARate = 0
    Else
        OldRate1 = OldRate
        IARate = 0.2
    End If
    If IsNumeric(NewRate) = False Then
        NewRate1 = Application.WorksheetFunction.VLookup(NewRate, Range("SRate"), 2, False)
        IARate = Application.WorksheetFunction.VLookup(OldRate, Range("SRate"), 3, False) / 100
    ElseIf OldRate = 100 And NewRate = 100 Then
            NewRate1 = NewRate
            IARate = 0
    ElseIf OldRate = 50 And NewRate = 50 Then
            NewRate1 = NewRate
            IARate = 0
    ElseIf YA <> Sheet2.Range("C4") And (OldRate = 50 And NewRate = 50) Then
            NewRate1 = NewRate
            IARate = 0
    Else
        NewRate1 = NewRate
    End If
    
'IA rate for IBA
    If OldRate1 = 2 Or NewRate1 = 2 Or OldRate1 = 3 Or NewRate1 = 3 Then IARate = 0.1
    
'Lookup no. years allowance was claimed
    If IsNumeric(YA) = True Then
        If YA < 1950 Then
            If YA <= 1 Then
                NumYr = 0
            Else
                NumYr = 50 'To restrict no. of years allowance was claimed
            End If
        Else
            NumYr = Application.WorksheetFunction.VLookup(YA, Range("YA_Tbl"), 2, False)
        End If
    Else
        NumYr = Application.WorksheetFunction.VLookup(YA, Range("YA_Tbl"), 2, False)
    End If
    
'Lookup no. years to 2000CYB
    CYBYr = Application.WorksheetFunction.VLookup("2000C", Range("YA_Tbl"), 2, False)
'Lookup no. years to YA2002
    NumYrB = Range("YrYA2002").Value
    
'To compute total % of AA claimed
    If NewRate1 = 3 And OldRate = 2 Then
        NewClaim = NewRate1 / 100 * NumYrB
        OldClaim = OldRate1 / 100 * (NumYr - NumYrB)
    ElseIf NewRate1 > 0 Then     'If NewRate is present
        NewClaim = NewRate1 / 100 * CYBYr
        OldClaim = OldRate1 / 100 * (NumYr - CYBYr)
    Else
        NewClaim = 0
        OldClaim = OldRate1 / 100 * NumYr
    End If
    
    'TotalClaim = Round((NewClaim + OldClaim + IARate) * QC, 0)
    If YA = Sheet2.Range("C4") And (OldRate = "A10" And NewRate = "A10") Then
        TotalClaim = Round((0.1) * QC, 0)
    ElseIf YA = Sheet2.Range("C4") And (OldRate = "A20" And NewRate = "A20") Then
        TotalClaim = Round((0.2) * QC, 0)
    ElseIf YA = Sheet2.Range("C4") And (OldRate = "A50" And NewRate = "A50") Then
        TotalClaim = Round((0.5) * QC, 0)
    ElseIf YA = Sheet2.Range("C4") And (OldRate = 100 And NewRate = 100) Then
        TotalClaim = 0
    ElseIf YA = Sheet2.Range("C4") And (OldRate = 50 And NewRate = 50) Then
        TotalClaim = 0
    Else
        TotalClaim = Round((NewClaim + OldClaim + IARate) * QC, 0)
    End If
    Claimed = Application.WorksheetFunction.Min(TotalClaim, QC)
End Function

Just to clarify...
 
Upvote 0

Forum statistics

Threads
1,223,956
Messages
6,175,619
Members
452,661
Latest member
Nonhle

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