Sintaxis de código para un correcto funcionamiento
Alguien me podrá ayudar a verificar que la sintaxis del código sea la correcta, ya que se pone lento excel, al momento de correr el programa, cabe mencionar que hice un mezcla de muchos código y si funciona bien, pero como que algo falla al momento de cambiar minúsculas a mayúsculas
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Value = UCase(Target.Value) ***CAMBIA MINUSCULAS A MAYUSCULAS**
Checker = InStrRev(Target, "/") *** DIVIDE UN TEXTO A PARTIR DE LA /***
If Target.Column = 3 And Target.Row > 1 And Checker > 0 Then
Modelo = Right(Target, Len(Target) - InStrRev(Target, "/"))
ActiveSheet.Cells(Target.Row, Target.Column + 1).Value = Modelo
ElseIf Target.Column = 4 And Target.Row > 1 Then
Check2 = InStr(ActiveSheet.Cells(Target.Row, Target.Column - 1).Value, "/")
If Check2 > 0 Then
InicVal = Left(ActiveSheet.Cells(Target.Row, Target.Column - 1).Value, InStr(ActiveSheet.Cells(Target.Row, Target.Column - 1), "/") - 1)
ActiveSheet.Cells(Target.Row, Target.Column - 1).Value = InicVal
ActiveCell.Offset(0, 1).Activate
End If
End If
Checker = InStrRev(Target, "P") ****DIVIDE EL TEXTO A PARTIR DE LA P****
If Target.Column = 6 And Target.Row > 1 And Checker > 0 Then
Modelo = Right(Target, Len(Target) - InStrRev(Target, "P"))
ActiveSheet.Cells(Target.Row, Target.Column + 0).Value = Modelo
ElseIf Target.Column = 7 And Target.Row > 1 Then
Check2 = InStr(ActiveSheet.Cells(Target.Row, Target.Column - 1).Value, "P")
If Check2 > 0 Then
InicVal = Left(ActiveSheet.Cells(Target.Row, Target.Column - 1).Value, InStr(ActiveSheet.Cells(Target.Row, Target.Column - 1), "P") - 1)
ActiveSheet.Cells(Target.Row, Target.Column - 1).Value = InicVal
End If
End If
Checker = InStrRev(Target, " ") ****QUITA LOS ESPACIOS DE UN TEXTO***
If Target.Column = 6 And Target.Row > 1 And Checker > 0 Then
Modelo = Right(Target, Len(Target) - InStrRev(Target, " "))
ActiveSheet.Cells(Target.Row, Target.Column + 1).Value = Modelo
ElseIf Target.Column = 7 And Target.Row > 1 Then
Check2 = InStr(ActiveSheet.Cells(Target.Row, Target.Column - 1).Value, " ")
If Check2 > 0 Then
InicVal = Left(ActiveSheet.Cells(Target.Row, Target.Column - 1).Value, InStr(ActiveSheet.Cells(Target.Row, Target.Column - 1), " ") - 1)
ActiveSheet.Cells(Target.Row, Target.Column - 1).Value = InicVal
End If
ActiveCell.Offset(1, -5).Activate ***MUEVE A LA CELDA INFERIOR ***
End If
End Sub