I tried to combine all the codes together to make it look at one record at a time. The second part of the codes are looking at all the rows in a loop. Ideally, I would like to look at customer A's record and hide the row#66 or row#64. After that the code is supposed to start over from the top to look at Customer B,C,D... Thanks to the people who answered my questions about for loop. Thank you
Dim c As Range
Dim d As Range
With ThisWorkbook.Sheets("Template")
.Rows.EntireRow.Hidden = False
.Activate
For Each c In .Range("E27,E32,E35,L36,L37,E39,E40,E41,E42,E43,E44,E45,E46,E49,E50,E51")
If c.Value = 0 Then
c.EntireRow.Hidden = True
Else
c.EntireRow.Hidden = False
End If
Next
End With
With Worksheets("Template")
If .Range("E26").Value = 0 Or .Range("E27") = 0 Then
Worksheets("Template").Rows("69").EntireRow.Hidden = True
Else
Worksheets("Template").Rows("69").EntireRow.Hidden = False
End If
If .Range("E32").Value = 0 Then
Worksheets("Template").Rows("70").EntireRow.Hidden = True
Else
Worksheets("Template").Rows("70").EntireRow.Hidden = False
End If
End With
Dim r As Range
Dim ws2 As Worksheet: Set ws2 = ThisWorkbook.Worksheets("Data File")
For Each r In ws2.Range("CU3:CU5")
If r.Value = "RSU" And r.Offset(0, 1).Value = "Y" Then
Worksheets("Template").Rows("66").EntireRow.Hidden = False
Worksheets("Template").Rows("64").EntireRow.Hidden = True
Else
Worksheets("Template").Rows("66").EntireRow.Hidden = True
Worksheets("Template").Rows("64").EntireRow.Hidden = False
End If
Next r
Here's one way you could do it, but I'm still confused how you account for multiple rows in the range you're looping over - you will be left with whatever the match works out as from the last row in that range.
EDIT: after your update