troubleshooting Question

Add in Condition

Avatar of Billa7
Billa7 asked on
Microsoft Excel
5 Comments1 Solution355 ViewsLast Modified:
How to add one more condition in this attached script:

If column D cell has (KK), replaced the cell data into word "Copy"

Hope Experts could help add this additional feature.

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

Sheets("Data").Activate

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

n = 6

For Each xCell In Range(Cells(n, "D"), Cells(xLast_Row, "D"))
    
    If xCell = "(YK) Match Title" Then
     xCell = "Type2"
     
    ElseIf xCell.Offset(0, -3) <> "" And InStr(xCell, "File") = 0 And InStr(xCell, "Record") = 0 And _
        InStr(xCell, "Repeat") = 0 Then
        
        xHold = xCell
        If Mid(xHold, 1, 3) = "(L)" Then
            xCell = "Match"
            
                       
        ElseIf Mid(xHold, 1, 4) = "(FR)" Then
            xCell = "Log"
        
            
        Else
            xCell = "Repeat"
        End If
    End If
    Range("C4") = "_Issued on " & Format(Now, "mm.dd.yyyy"" @ ""hhmm")
Next xCell

End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
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 1 Answer and 5 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