Add an If, and statement so only the boxes under the scenarios get checked and not the whole row

Nlhicks

Board Regular
Joined
Jan 8, 2021
Messages
244
Office Version
  1. 365
Platform
  1. Windows
Test Tracking Test2 adding new section.xlsm
ABC
1SPS#ResultScenarios ran
2D_ANT_SFTY_01PassAbort_12
3D_ANT_SFTY_02FailHot_Cut_3
4D_ANT_SFTY_03PassOmega_1
5BITO_1010PassCold_Cut_1
6BITO_1011Pass
7BITO_1012Pass
8BITO_1013Pass
9QNTI_01Pass
10QNTI_02Fail
11QNTI_03Pass
12PLT_555Pass
13PLT_556Pass
14PLT_557Pass
15DPIP_01Fail
Sheet2


Test Tracking Test2 adding new section.xlsm
HIJKLMNOP
5Abort_12Cold_Cut_2Hot_Cut_1Hot_Cut_3Omega_1Pharos_1Hot_Cut_2Cold_Cut_1
6D_ANT_SFTY_01++++
7D_ANT_SFTY_02---
8D_ANT_SFTY_03
9BITO_1010++
10BITO_1011++++++
11BITO_1012++++
12BITO_1013++++
13QNTI_01
14QNTI_02----
15QNTI_03++
16PLT_555++++
17PLT_556++++
18PLT_557
19DPIP_01----
Sheet1


Sub Test2()
If ActiveSheet.Name <> "Sheet2" Then
MsgBox "Run this from the Sheet 2.", 64, "Note:"
Exit Sub
End If

Application.ScreenUpdating = False
Dim cellEstelle As Range, strEstelle$, strPassFail$
Dim varFindScenario As Variant, lngFindScenario&, lngNextCol&, xCol&

With Sheets("Sheet1")

For Each cellEstelle In Columns(1).SpecialCells(2)
Set varFindScenario = Nothing
strEstelle = cellEstelle.Value
Set varFindScenario = .Columns(8).Find(What:=strEstelle, LookIn:=xlFormulas, LookAt:=xlWhole)

If Not varFindScenario Is Nothing Then
lngFindScenario = varFindScenario.Row
'Modify thse column number boundaries as needed.
If lngFindScenario >= 6 And lngFindScenario <= 19 Then
If Cells(cellEstelle.Row, 2).Value = "Pass" Then
strPassFail = "+"
Else
strPassFail = "-"
End If

For xCol = 9 To 16
If Len(.Cells(lngFindScenario, xCol).Value) = 0 And .Cells(lngFindScenario, xCol).Interior.ColorIndex = -4142 Then .Cells(lngFindScenario, xCol).Value = strPassFail
Next xCol

End If
End If
Next cellEstelle

End With

Set varFindScenario = Nothing
Application.ScreenUpdating = True
MsgBox "Completed.", , "Done."
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Only put a + or - in the columns if the scenario was run
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,658
Members
449,177
Latest member
Sousanna Aristiadou

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