Why do I keep getting Compile Error: End If without if block
Here is my code.
Sub TotalFluid()
Dim i, j, k As Integer
Dim totalFluids As Integer
Dim fID As Integer
i = 2
j = 2
totalFluids = 0
Do While i < 37
Workbooks("Book1.xlsm").Sheets("Sheet1").Activate
dVal = Cells(i, 7)
For j = 2 To 58
Set oBook = Workbooks("Book2.xlsx")
With oBook.Sheets("Sheet2")
d = Cells(j, 1)
For k = 1 To Len(d)
oneChar = VBA.Strings.Mid(d, j, 1)
d1 = d1 & oneChar
If oneChar = "/" And k > 3 Then
d1 = d1 & "2009"
k = Len(d)
End If
Next k
If dVal = d1 Then
Set oBook = Workbooks("Book2.xlsx")
With oBook.Sheets("Sheet2")
If d2 Like d1 Then
totalFluids = ActiveSheet.Cells(j, 4) + totalFluids
Workbooks("Book1.xlsm").Sheets("Sheet1").Activate
ActiveSheet.Cells(i, 9) = totalFluids
totalFluids = 0
d2 = d1
ElseIf d2 <> d1 Then
totalFluids = ActiveSheet.Cells(j, 4) + totalFluids
d2 = d1
End If
End If
Next j
i = i + 1
Loop
'
End Sub