Option Explicit Function Zbir(KolonaZbira As Range, KolonaPDV As String, IznosPDV As Integer) Dim Suma As Currency Dim Celija Dim Pdv As Integer Dim R As Range Dim CelijaPdv For Each Celija In KolonaZbira.Cells CelijaPdv = KolonaPDV & Celija.Row Set R = ActiveSheet.Range(CelijaPdv) Pdv = R.Cells If Pdv = IznosPDV Then Suma = Suma + Celija End If Zbir = Suma Next Celija End Function