troubleshooting Question

Add If Condition

Avatar of Billa7
Billa7 asked on
Microsoft Excel
7 Comments2 Solutions378 ViewsLast Modified:
Please help. How to add one more if condition in the attached script:

If Column D with "DK/TypeKL10/5 F185" , change into "New Entries" 

Sub Update_Type()

Dim xLast_Row As Long
Dim xCell As Range
Dim xHold As String
Dim n As Long
Dim rFind As Range


xLast_Row = Range("A1").SpecialCells(xlLastCell).Row

n = 6
For Each xCell In Range(Cells(n, "D"), Cells(xLast_Row, "D"))

    If xCell.Offset(0, -3) <> "" And InStr(xCell, "TypeAA") = 0 And InStr(xCell, "Match") = 0 And _
    InStr(xCell, "LostS") = 0 Then
        xHold = xCell
        If Mid(xHold, 1, 3) = "(L)" Then
            xCell = "TypeAA"
        ElseIf Mid(xHold, 1, 4) = "(FR)" Then
            xCell = "Match"
            xCell = "LostS"
        End If
    End If
Range("C4") = "_Issued on " & Format(Now, "mm.dd.yyyy"" @ ""hhmm")
Next xCell

End Sub

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros