Hi, I use this code to insert values at Column J based on Column B. This code works perfectly fine but I think this is too long. Perhaps there are others ways to simplify my code.
Code:
Dim LastRow As Long
Dim z As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For z = 2 To LastRow
If Range("B" & z).Value = "A-01" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-02" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-03" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-04" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-05" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-06" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-58" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-59" Then
Range("J" & z).Value = "Min. Material Level"
ElseIf Range("B" & z).Value = "A-07" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-08" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-09" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-10" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-11" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-12" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-60" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-61" Then
Range("J" & z).Value = "Material Flow"
ElseIf Range("B" & z).Value = "A-13" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-14" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-15" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-16" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-17" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-18" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-62" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-63" Then
Range("J" & z).Value = "Doser Deviation"
ElseIf Range("B" & z).Value = "A-24" Then
Range("J" & z).Value = "SAF.SW.Tripped Or No Comp. Air"
End If
Next z