Results 1 to 4 of 4

my user defined function doesn'work

Threaded View

  1. #1
    Registered User
    Join Date
    05-21-2012
    Location
    Bucurest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    3

    my user defined function doesn'work

    dear all,
    I tried to create a User Defined function to calculate a price with some if nested and
    the item keep from tables.

    Could you help me ?
    many thanks

    I have excel 2003.

    here the code and the sheet in simplified way as attachment

    Public Function Calcoloprezzo(Quantitacopie As Variant, Note As Variant, Pagine As Variant, _
    Tabella_sino As Range, TABtariffeFF As Range, TABtariffeFV As Range, _
    Tipoconfez As Variant, Formatolibro As Variant, _
    Grammaturacarta As Variant) As Variant
    '
    
    
    'Application Volatile
    '
    Dim Calcoloprezzocopia As Variant
    Dim Quantitacopie As Variant
    Dim Note As Variant
    Dim Pagine As Variant
    Dim Tabella_sino As Range
    Dim TABtariffeFF As Range
    Dim TABtariffeFV As Range
    Dim Tipoconfez As Variant
    Dim Formatolibro As Variant
    Dim Grammaturacarta As Variant
    Dim Codicericerca As Variant
    Dim VAR1 As Variant
    Dim VAR2 As Variant
    Dim VAR3 As Variant
    Dim VAR4 As Variant
    Dim VAR5 As Variant
    
    Codicericerca = Tipoconfez & Formatolibro & Grammaturacarta
    
    VAR1 = WorksheetFunction.VLookup(Codicericerca, Tabella_sino, 2)
    
    If VLookup(Codicericerca, Tabella_sino, 2) = "NO" Then
    Calcoloprezzocopia = "NO PRICES LIST"
    
    Else
        If Note <> "" Then
        Calcoloprezzocopia = "EXTRACOSTS"
        Else
            If Pagine > 64 Then
            Calcoloprezzocopia = "ATTN high number of pages"
            Else:
            VAR2 = WorksheetFunction.VLookup(Codicericerca, TABtariffeFF, 2)
            VAR3 = WorksheetFunction.HLookup(Pagine, TABtariffeFF, 2)
            VAR4 = WorksheetFunction.VLookup(Codicericerca, TABtariffeFV, 2)
            VAR5 = WorksheetFunction.HLookup(Pagine, TABtariffeFV, 2)
                  
            Calcoloprezzocopia = WorksheetFunction.Index(TABtariffeFF, VAR2, VAR3) _
            / Quantitacopie + Index(TABtariffeFV, VAR2, VAR3)
            
            End If
        End If
    End If
    
    End Function
    [/SIZE]
    Attached Files Attached Files
    Last edited by arlu1201; 05-21-2012 at 03:11 AM. Reason: Please put code tags in future.

Thread Information

Users Browsing this Thread

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

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