Function Suma(R) Dim Celija As Object Dim Duz(1 To 2) As Integer Dim FormatCelije As String Dim a Dim BrA As Double Dim StrA As String Dim S As Double For Each Celija In R.Cells a = Celija() If IsNumeric(a) = False Then MsgBox "Neispravan unos u celiji:" & Celija.Address GoTo Kraj End If BrA = a StrA = a Duz(1) = Len(Format$(BrA)) Duz(2) = Len(StrA) If Duz(1) <> Duz(2) Then MsgBox "Nevalja format u celiji:" & Celija.Address GoTo Kraj End If S = S + Celija() Next Celija Suma = Application.WorksheetFunction.Sum(R) 'Suma = S Exit Function Kraj: Suma = "Greška" End Function