vidyavallaba
New Member
- Joined
- Dec 17, 2013
- Messages
- 42
Hi,
Im trying to use if condition inside a select case.. But the problem is... the condition is not executed..
How can i achieve this? i have to consider each row and perform multiple checks on it and insert a text in the last column. Can any one help me to break this shell??
lrw = sourcesheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To lrw
Select Case invalid
Case "A"
If InStr(1, Sheet2.Range("U1").Offset(i, 0).Value, "INPAT") > 0 Or InStr(1, Sheet2.Range("U1").Offset(i, 0).Value, "EXPAT") > 0 Then
If InStr(1, Sheet2.Range("AW1").Offset(i, 0).Value, "Optimus") > 0 Then
GoTo NextRecPC6
End If
End If
NextRecPC6: Sheet2.Range("Ay1").Value = "Inpat/Expat"
End Select
Next
The above code parses each row till the last row and should check the given condition and write a text to a column
Im trying to use if condition inside a select case.. But the problem is... the condition is not executed..
How can i achieve this? i have to consider each row and perform multiple checks on it and insert a text in the last column. Can any one help me to break this shell??
lrw = sourcesheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To lrw
Select Case invalid
Case "A"
If InStr(1, Sheet2.Range("U1").Offset(i, 0).Value, "INPAT") > 0 Or InStr(1, Sheet2.Range("U1").Offset(i, 0).Value, "EXPAT") > 0 Then
If InStr(1, Sheet2.Range("AW1").Offset(i, 0).Value, "Optimus") > 0 Then
GoTo NextRecPC6
End If
End If
NextRecPC6: Sheet2.Range("Ay1").Value = "Inpat/Expat"
End Select
Next
The above code parses each row till the last row and should check the given condition and write a text to a column