Hi - I just wondered if there is a way of shortening this code down (loop it?)?
I want to apply this code to rows 4:43 but excluding rows 8,9,19,20,27,28,40,41
Otherwise I need to write the above 26 more times and changing the row numbers so just wondering if there was a way to loop the same code through a specific range set (rather than manually type it out for each row)
Thanks in advance for your help
I want to apply this code to rows 4:43 but excluding rows 8,9,19,20,27,28,40,41
Code:
If Range("AM4").Value = "E" Then
Range("P4:S4").Value = "Lunch"
Range("T4:W4").Value = ""
Range("AH4:AK4").Value = "*"
End If
If Range("AM4").Value = "MS" Then
Range("R4:U4").Value = "Lunch"
Range("P4:Q4,V4:W4") = ""
Range("D4,AJ4:AK4") = "*"
End If
If Range("AM4").Value = "L" Then
Range("T4:W4") = "Lunch"
Range("P4:S4") = ""
Range("D4:E4") = "*"
End If
If Range("AM4").Value = "ASH" Then
Range("D4:AK4").Value = "ASH"
Range("C4").Value = "True"
End If
If Range("AM5").Value = "E" Then
Range("P5:S5").Value = "Lunch"
Range("T5:W5").Value = ""
Range("AH5:AK5").Value = "*"
End If
If Range("AM5").Value = "MS" Then
Range("R5:U5").Value = "Lunch"
Range("P5:Q5,V5:W5") = ""
Range("D5,AJ5:AK5") = "*"
End If
If Range("AM5").Value = "L" Then
Range("T5:W5") = "Lunch"
Range("P5:S5") = ""
Range("D5:E5") = "*"
End If
If Range("AM5").Value = "ASH" Then
Range("D5:AK5").Value = "ASH"
Range("C5").Value = "True"
End If
If Range("AM6").Value = "E" Then
Range("P6:S6").Value = "Lunch"
Range("T6:W6").Value = ""
Range("AH6:AK6").Value = "*"
End If
If Range("AM6").Value = "MS" Then
Range("R6:U6").Value = "Lunch"
Range("P6:Q6,V6:W6") = ""
Range("D6,AJ6:AK6") = "*"
End If
If Range("AM6").Value = "L" Then
Range("T6:W6") = "Lunch"
Range("P6:S6") = ""
Range("D6:E6") = "*"
End If
If Range("AM6").Value = "ASH" Then
Range("D6:AK6").Value = "ASH"
Range("C6").Value = "True"
End If
If Range("AM7").Value = "E" Then
Range("P7:S7").Value = "Lunch"
Range("T7:W7").Value = ""
Range("AH7:AK7").Value = "*"
End If
If Range("AM7").Value = "MS" Then
Range("R7:U7").Value = "Lunch"
Range("P7:Q7,V7:W7") = ""
Range("D7,AJ7:AK7") = "*"
End If
If Range("AM7").Value = "L" Then
Range("T7:W7") = "Lunch"
Range("P7:S7") = ""
Range("D7:E7") = "*"
End If
If Range("AM7").Value = "ASH" Then
Range("D7:AK7").Value = "ASH"
Range("C7").Value = "True"
End If
If Range("AM10").Value = "E" Then
Range("P10:S10").Value = "Lunch"
Range("T10:W10").Value = ""
Range("AH10:AK10").Value = "*"
End If
If Range("AM10").Value = "MS" Then
Range("R10:U10").Value = "Lunch"
Range("P10:Q10,V10:W10") = ""
Range("D10,AJ10:AK10") = "*"
End If
If Range("AM10").Value = "L" Then
Range("T10:W10") = "Lunch"
Range("P10:S10") = ""
Range("D10:E10") = "*"
End If
If Range("AM10").Value = "ASH" Then
Range("D10:AK10").Value = "ASH"
Range("C10").Value = "True"
End If
If Range("AM11").Value = "E" Then
Range("P11:S11").Value = "Lunch"
Range("T11:W11").Value = ""
Range("AH11:AK11").Value = "*"
End If
If Range("AM11").Value = "MS" Then
Range("R11:U11").Value = "Lunch"
Range("P11:Q11,V11:W11") = ""
Range("D11,AJ11:AK11") = "*"
End If
If Range("AM11").Value = "L" Then
Range("T11:W11") = "Lunch"
Range("P11:S11") = ""
Range("D11:E11") = "*"
End If
If Range("AM11").Value = "ASH" Then
Range("D11:AK11").Value = "ASH"
Range("C11").Value = "True"
End If
Otherwise I need to write the above 26 more times and changing the row numbers so just wondering if there was a way to loop the same code through a specific range set (rather than manually type it out for each row)
Thanks in advance for your help