Change the code from looking in Row (5) and fill down to looking in Column (8) and filling across

Nlhicks

Board Regular
Joined
Jan 8, 2021
Messages
244
Office Version
  1. 365
Platform
  1. Windows
Requirement burndown sheet:
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
Requirement Burndown Table

Old Macro Estelle Tracking Sheet:
Test Tracking Test2 adding new section.xlsm
AB
1Run One
2Abort_12Pass
3Hot_Cut_1Fail
4Omega_1Pass
5Cold_Cut_1Fail
6Cold_Cut_2Pass
7Hot_Cut_2Fail
8Pharos_1Pass
Estelle Tracking

Old Macro:
VBA Code:
Sub Test2()
If ActiveSheet.Name <> "Estelle Tracking" Then
MsgBox "Run this from the Estelle Tracking Sheet.", 64, "Note:"
Exit Sub
End If

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

With Sheets("Requirement Burndown Table")

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

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

For xRow = 6 To 18
If Len(.Cells(xRow, lngFindScenario).Value) = 0 And .Cells(xRow, lngFindScenario).Interior.ColorIndex = -4142 Then .Cells(xRow, lngFindScenario).Value = strPassFail
Next xRow

End If
End If
Next cellEstelle

End With

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

Sheet1:
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


Sheet 2:
Test Tracking Test2 adding new section.xlsm
AB
1One
2D_ANT_SFTY_01Pass
3D_ANT_SFTY_02Fail
4D_ANT_SFTY_03Pass
5BITO_1010Pass
6BITO_1011Pass
7BITO_1012Pass
8BITO_1013Pass
9QNTI_01Pass
10QNTI_02Fail
11QNTI_03Pass
12PLT_555Pass
13PLT_556Pass
14PLT_557Pass
15DPIP_01Fail
Sheet2


New Macro that is not working right I think the problem is in the underlined and bolded section :
Rich (BB code):
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 >= 9 And lngFindScenario <= 16 Then
If Cells(cellEstelle.Row, 2).Value = "Pass" Then
strPassFail = "+"
Else
strPassFail = "-"
End If

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

End If
End If
Next cellEstelle

End With

Set varFindScenario = Nothing
Application.ScreenUpdating = True
MsgBox "Completed.", , "Done."
End Sub
 
Last edited by a moderator:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I got it to start looking at the right criteria but now the + and - are not going into the correct place. The underlined and bolded section seems to be the place that I am experiencing difficulty.
Does some one have a fix for that?
 
Upvote 0
Can someone please help? I have to take whatever I find here and extrapolate it out to a huge project that I have been working on since last Christmas.
 
Upvote 0
I think your best bet would be to tell us what you expect it to do and what it actually is or isn't doing.
 
Upvote 0
No Sparks, This is what the bottom code is doing. It is pasting in a + or - but not with the correct result. According to the special cell D_ANT_SFTY_01 should have a + in every empty cell in that row but as you can see it has a - in one of them.

Test Tracking Test2 adding new section.xlsm
HIJKLMNOP
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+++-
20+++++-++
Sheet1
 
Upvote 0
I haven't tested your code but I would say a problem is:

VBA Code:
For xCol = 6 To 20
If Len(.Cells(xCol, lngFindScenario).Value) = 0 And .Cells(xCol, lngFindScenario).Interior.ColorIndex = -4142 Then .Cells(xCol, lngFindScenario).Value = strPassFail
Next xCol

cells uses (rows, columns) format. When you changed from the old code, you switched the names from row to col, but you didn't flip flop the variables in the parentheses.

I also think the 6 in your counter should be 9 to reflect the 9th column and the 20 should be 16 for the P column?
 
Upvote 0
I haven't tested your code but I would say a problem is:

VBA Code:
For xCol = 6 To 20
If Len(.Cells(xCol, lngFindScenario).Value) = 0 And .Cells(xCol, lngFindScenario).Interior.ColorIndex = -4142 Then .Cells(xCol, lngFindScenario).Value = strPassFail
Next xCol

cells uses (rows, columns) format. When you changed from the old code, you switched the names from row to col, but you didn't flip flop the variables in the parentheses.
I will try that and see what happens
 
Upvote 0
I haven't tested your code but I would say a problem is:

VBA Code:
For xCol = 6 To 20
If Len(.Cells(xCol, lngFindScenario).Value) = 0 And .Cells(xCol, lngFindScenario).Interior.ColorIndex = -4142 Then .Cells(xCol, lngFindScenario).Value = strPassFail
Next xCol

cells uses (rows, columns) format. When you changed from the old code, you switched the names from row to col, but you didn't flip flop the variables in the parentheses.

I also think the 6 in your counter should be 9 to reflect the 9th column and the 20 should be 16 for the P column?
I haven't tested your code but I would say a problem is:

VBA Code:
For xCol = 6 To 20
If Len(.Cells(xCol, lngFindScenario).Value) = 0 And .Cells(xCol, lngFindScenario).Interior.ColorIndex = -4142 Then .Cells(xCol, lngFindScenario).Value = strPassFail
Next xCol

cells uses (rows, columns) format. When you changed from the old code, you switched the names from row to col, but you didn't flip flop the variables in the parentheses.

I also think the 6 in your counter should be 9 to reflect the 9th column and the 20 should be 16 for the P column?
Thank you sooooo very much JohnnyL, that was the solution. It works perfectly now, You are outstanding. You made my whole day, week and I am pretty sure month.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,742
Members
448,989
Latest member
mariah3

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