Please help!!
I have the macro below to return a result in column 13, row 2. The result is based on selections in columns 10, 11 and 12 of the same row. The macro appears to run and doesn't show an error in the code, but no result appears. I've started and stared, but can't see the problem
[
Private SubCommandButton21_Click()
Dim score1 AsString, score2 As String, Score3 As String, result As String, x As Integer
x = 2
Do WhileCells(x, 10).Value <> ""
score1 =Cells(x, 10).Value
score2 =Cells(x, 11).Value
Score3 =Cells(x, 12).Value
If score1>= "Y " And score2 >= "N" And Score3>= "" Then
result = "do this"
ElseIf score1>= "Y " And score2 >= "Y" AndScore3 >= "" Then
result = “do that"
ElseIf score1>= "N" And score2 >= "" And Score3 >="Y" Then
result = "do the other "
ElseIf score1>= "N" And score2 >= "" And Score3 >="N" Then
result = "do nowt"
End If
Cells(x,13).Value = result
x = x + 1
Loop
End Sub]
I have the macro below to return a result in column 13, row 2. The result is based on selections in columns 10, 11 and 12 of the same row. The macro appears to run and doesn't show an error in the code, but no result appears. I've started and stared, but can't see the problem
[
Private SubCommandButton21_Click()
Dim score1 AsString, score2 As String, Score3 As String, result As String, x As Integer
x = 2
Do WhileCells(x, 10).Value <> ""
score1 =Cells(x, 10).Value
score2 =Cells(x, 11).Value
Score3 =Cells(x, 12).Value
If score1>= "Y " And score2 >= "N" And Score3>= "" Then
result = "do this"
ElseIf score1>= "Y " And score2 >= "Y" AndScore3 >= "" Then
result = “do that"
ElseIf score1>= "N" And score2 >= "" And Score3 >="Y" Then
result = "do the other "
ElseIf score1>= "N" And score2 >= "" And Score3 >="N" Then
result = "do nowt"
End If
Cells(x,13).Value = result
x = x + 1
Loop
End Sub]