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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
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,214,911
Messages
6,122,195
Members
449,072
Latest member
DW Draft

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