Good Morning - I know my brain would end up in knots trying to solve that one. Nested For loops is scary enough but for added piquancy I need to check out two conditions.
I have a long list of people. Their name is in Column B. In Column C is their function. I have a formula in Column A that puts an x into the cell if the region matches another criteria. Now I'm trying to add all people that have an x in column A and match the function in column C.
If I'm trying to step my brain through this, it should work but I get an error "Invalid Next control variable reference".
Any suggestions very much appreciated. Thanks.
Code
Dim lastrow As Long
lastrow = sh3.Cells(Rows.Count, 1).End(xlUp).Row
Dim myRange As Range 'Column A - needs an x
Dim rngCommercial As Range 'Column C - function needs to be match
For Each rngCommercial In sh3.Range("C1:C" & lastrow)
If rngCommercial = "Commercial" Or "SalesOps" Then
For Each myRange In sh3.Range("A1:A" & lastrow)
If myRange = "x" Then
strCommercial = strCommercial & rngCommercial.Offset(0, -1).Value & "; "
Exit For
End If
Next rngCommercial
Display More