Need help with Selecting muiple Cells and then checking all of the values in a IF statment.

aragon123321

New Member
Joined
Jul 6, 2015
Messages
26
Why will this not work?
Does anyone know how they could check each score in a range and run each cell through the If statment.
Here is what I have.

Thank You! Or if you have a link to where i could find the answer I would really appreciate that also.:)


Dim Cell As Integer, result As String
Cell = Range("B3:B15").Value
If score >= 6 Then
result = "pass"
Else
result = "fail"
End If
Range("B1").Value = result
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Check each range and result is in column C.


Sub sample()
Dim Cell, result As String, i As Long
i = 3
For Each Cell In Range("B3:B15").Value
If Cell >= 6 Then
Cells(i, 3).Value = "pass"
Else
Cells(i, 3).Value = "fail"
End If
i = i + 1
Next
End Sub


Or, all score must be over 6.

Sub Sumple1()
Dim Cell, result As String, i As Long
For i = 3 To 15
If Cells(i, 2).Value < 6 Then
Range("B1").Value = "fail"
Exit Sub
End If
Next
Range("B1").Value = "pass"
End Sub
 
Upvote 0
Thank you so much!!! This is perfect you are a beast Takae!! :) I really appreciate it, I was stuck on that for a little while trying to get what I wanted.
Thanks!
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top