Hi, I'm getting an "Else without If" Error message from the following code. The last Else is where the error points to. I have 2 If's, 2 Elses, and 2 EndIf's, so I can't figure out what the error is. Can you please help?
Code:
Sub Assign_Zero_Or_One()
Dim r As Integer
Dim n As Integer
r = -1
n = 0
Range("z3").Select
While ActiveCell.Offset(1, 0) <> 0 Or ActiveCell.Offset(1, 0) <> " "
ActiveCell.Offset(1, 0).Select
If ActiveCell = "PF" Then
ActiveCell.Offset(1, 1).Select
While ActiveCell.Offset(1, -1) <> "T"
n = n + ActiveCell
r = r - 1
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Offset(r, 0).Select
If n > 0 Then ActiveCell = 1
Else: ActiveCell = 0
End If
ActiveCell.Offset(1, -1).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Wend
End Sub
Last edited by a moderator: