Hello all,

I'm looking to store different values to a variable that would be holding a vlookup function. I'm storing the variable as a double, but one of the criteria that my macro checks is to make sure that the vlookup is actually succesful, (i.e. if iserror(application.vlookup(BLAHBLAH)) then).

Here's the example I'm talking about:

'VPL Pricing
    VPL = Application.VLookup(Cells(50 + x, 1), Sheets("CATALOGFORMACRO").Range("$A:$N"), 9 + y, False)
    'Pallet Pricing
    PAL = Application.VLookup(Cells(50 + x, 1), Sheets("CATALOGFORMACRO").Range("$B:$N"), 8 + y, False)

    x = 0
    c = 1
    y = 0
    r = 0
    
    Do While (Not Cells(50 + x, 1) = "Fin")
    
        Do While (y < 6)
        
            If IsError(VPL) Then
            
                Cells(50 + x, 6) = "DISC"
                x = x + 1
                y = 6
                
            Else
                
                If (Cells(50 + x, 5) < VPL) Then
                    y = y + 1
                
                Else
                
                    If VPL = "" Then
                        
                        'Check for Master
                        If VPL = "" And PAL <> "" Then
                            
                            If  --------- so on and so forth
Is this something that is allowed in VBA? Do I have to declare the variable as a certain type?

Any help would be great. Thank you very much