Billa7
asked on
Add If Condition
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"
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
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.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"
Else
xCell = "LostS"
End If
End If
Range("C4") = "_Issued on " & Format(Now, "mm.dd.yyyy"" @ ""hhmm")
Next xCell
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
n=6 indicates that the loop started with row 6.
Do you have any sample for this exceptional case?
Do you have any sample for this exceptional case?
ASKER
Hi chwong67,
In fact I can't really trace at what condition this thing happen:(
In fact I can't really trace at what condition this thing happen:(
In this macro, there is control for the loop (started with row 6).
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help
ASKER
Thanks for the revised code. I need your help, sometime I noticed the code update cell D5 as well with "LostS". By right any update should be after row 5. Is that a way to prevent this?