La funcion RIGHT devuelve parte de una cadena de texto, contando desde la derecha, la funcion LEFT contando desde el comienzo de la cadena. Por ejemplo LEFT("Ruben", 3) devuelve "Rub", y RIGHT("Torres", 4) devuelve "rres".
Esto es super util si tienes una cadena de texto como "00P2181401154H/XHQGDC14011527739" y quieres buscar ya sea la cadena completa, o solo "00P2181401154H", "XHQGDC14011527739"
Una vez especificado el texto a buscar, se puede definir si el resultado de la busqueda va a ser el texto completo o parte de el con xlWhole o xlPart.
Function encontrarpljosue(plnumber As String)
If Not ThisWorkbook.Sheets("Delivered").UsedRange.Find(plnumber, lookat:=xlPart, MatchCase:=False) Is Nothing Then
encontrarpljosue = "OK, entregado a FIN"
Else
If Not ThisWorkbook.Sheets("Delivered").UsedRange.Find(Right(plnumber, 17), lookat:=xlPart, MatchCase:=False) Is Nothing Then
encontrarpljosue = "OK, entregado a FIN"
Else
If Not ThisWorkbook.Sheets("Delivered").UsedRange.Find(Left(plnumber, 15), lookat:=xlPart, MatchCase:=False) Is Nothing Then
encontrarpljosue = "OK, entregado a FIN"
Else
If Not ThisWorkbook.Sheets("Delivered").UsedRange.Find(Left(plnumber, 14), lookat:=xlPart, MatchCase:=False) Is Nothing Then
encontrarpljosue = "OK, entregado a FIN"
Else
encontrarpljosue = "Pl NO ENTREGADO A FIN"
End If
End If
End If
End If
End Function
No hay comentarios:
Publicar un comentario