When I debug this script I get: division by zero!

In 3 lines over the debugging line, the script are writing out the variable "prosentref" as 1. Whatt can be wrong?

(the value in cell T8769 is 1)

Option Explicit

Sub optimaliseringDrift()

Dim Pgm1 As Integer

Dim Pgm2 As Integer

Dim PL As Integer

Dim lamda_gm1 As Double

Dim lamda_gm2 As Double

Dim deriv1 As Double

Dim deriv2 As Double

Const Pgm1_max As Integer = 200

Const Pgm2_max As Integer = 300

Const Pgm1_min As Integer = 45

Const Pgm2_min As Integer = 40

Const deltaP As Integer = 5

Dim i As Integer

Dim ef As Double

Dim nbv As Double

Dim nel1 As Double

Dim nel2 As Double

Dim dellast1 As Double

Dim dellast2 As Double

Dim prosentref As Double

Dim slingring1 As Double

Dim slingring2 As Double

Dim doteller As Integer

PL = ActiveSheet.Range("D2").Value

Pgm1 = Pgm1_min

dellast1 = Pgm1 / Pgm1_max

prosentref = ActiveSheet.Range("T8769").Value

slingring1 = dellast1 / prosentref

doteller = 0

Do Until slingring1 >= 1

prosentref = ActiveSheet.Range("T8769").Offset(doteller, 0)

slingring1 = dellast1 / prosentref

nel1 = ActiveSheet.Range("U8769").Offset(doteller, 0).Value

doteller = doteller + 1

Loop

ActiveSheet.Range("W8769") = nel1

ActiveSheet.Range("X8769") = prosentref

ActiveSheet.Range("Y8769") = doteller

Pgm2 = Pgm2_min

dellast2 = Pgm2 / Pgm2_max

prosentref = ActiveSheet.Range("T8769").Value

slingring2 = dellast2 / prosentref

doteller = 0

ActiveSheet.Range("Y8770") = doteller

ActiveSheet.Range("X8770") = prosentref

Do Until slingring2 >= 1

prosentref = ActiveSheet.Range("T8769").Offset(doteller, 0)

slingring2 = dellast2 / prosentref (debugging line)

nel2 = ActiveSheet.Range("U8769").Offset(doteller, 0).Value

doteller = doteller + 1

Loop

ActiveSheet.Range("W8770") = nel2

ActiveSheet.Range("X8770") = prosentref

ActiveSheet.Range("Y8770") = doteller

'ef = ActiveSheet.Range("R10").Value

'nbv = ActiveSheet.Range("P10").Value

'deriv1 = ef / (nbv * nel1)

'deriv2 = ef / (nbv * nel2)

End Sub