Hello All,
I am trying to write a simple code to look at a value then find that value in a row of values and if another cell says YES then add one to the YES column and if not then add to the no column. The problem keeps giving me an error and I can't figure it out.
Attached I have put an example of the data and here is my code.
Sub Confidence()
With Sheets("Confidence")
If .Range("k90") = "" Then Exit Sub
If .Range("k91") = "" Then Exit Sub
Set Rng = Sheets("Confidence").Rows(1).Find(Range("k90"), , xlValues, xlWhole).Offset(2)
If .Range("k91") = "Yes" Then Rng.Value = Rng.Value + 1 Else Rng.Offset(, 1) = Rng.Offset(, 1) + 1
End With
End Sub
Sheet Confidence:
Row 1 looks like:
[FONT="]A1: 5.30 b1: blank c1: 5.25 d1: blank e1: 5.2 (and so on down to 0)
Row 2 looks like:
A2: YES B2: NO C2: YES D2: NO and so on
Row 3 looks like:
A3: 4 B3: 1 C3: 7 (they all have numbers under each yes or no)
I can't attach a file.[/FONT]
I am trying to write a simple code to look at a value then find that value in a row of values and if another cell says YES then add one to the YES column and if not then add to the no column. The problem keeps giving me an error and I can't figure it out.
Attached I have put an example of the data and here is my code.
Sub Confidence()
With Sheets("Confidence")
If .Range("k90") = "" Then Exit Sub
If .Range("k91") = "" Then Exit Sub
Set Rng = Sheets("Confidence").Rows(1).Find(Range("k90"), , xlValues, xlWhole).Offset(2)
If .Range("k91") = "Yes" Then Rng.Value = Rng.Value + 1 Else Rng.Offset(, 1) = Rng.Offset(, 1) + 1
End With
End Sub
Sheet Confidence:
Row 1 looks like:
[FONT="]A1: 5.30 b1: blank c1: 5.25 d1: blank e1: 5.2 (and so on down to 0)
Row 2 looks like:
A2: YES B2: NO C2: YES D2: NO and so on
Row 3 looks like:
A3: 4 B3: 1 C3: 7 (they all have numbers under each yes or no)
I can't attach a file.[/FONT]
Last edited by a moderator: