Bonjour à tous,
Il y a quelques mois j'avais eu l'aide d'une personne pour créer une fonction personnalisé pour Excel.
Aujourd'hui j'aimerais l'importer à Google Sheets pour partager via le Drive mon fichier.
Voici la fonction complète de VBA :
Function Prix(Impression, Spec, Qté)
Dim Qty(), Price(), N As Integer, L As Integer, i As Integer
Prix = 0
If Impression = "" Or Spec = "" Then Exit Function
N = 0
DerLig = Range("Feuil1!B65500").End(xlUp).Row
tablo = Range("Feuil1!B3:E" & DerLig)
For L = 1 To UBound(tablo)
If tablo(L, 1) = Impression And tablo(L, 2) = Spec Then
ReDim Preserve Qty(N)
ReDim Preserve Price(N)
Qty(N) = tablo(L, 3)
Price(N) = tablo(L, 4)
N = N + 1
End If
Next L
For i = 0 To UBound(Qty)
If Qté < Qty(0) Then Prix = Price(0)
If Qté >= Qty(UBound(Qty)) Then Prix = Price(UBound(Qty))
If Qté >= Qty(i) Then Prix = Price(i)
Next i
End Function
J'ai cru comprendre que les fonctions n'étaient pas les mêmes entre VBA et Google Script mais je ne comprends pas comment la transformer pour qu'elle soit compatible avec Google Sheets.
Merci d'avance de votre aide