Minimizar cantidad de líneas en macro Excel

Para Danteamor

Hola DAM

Forma de minimizar la cantidad de líneas

Private Sub tbxCustom1_Change()
'Por.Dante Amor
    tbxCustom1 = Application.Proper(tbxCustom1)
    'Reemplazar 1ª letra
    tbxCustom1 = VBA.Replace(tbxCustom1, " Al ", " al ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " De ", " de ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " Del ", " del ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " La ", " la ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " Se ", " se ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " Si ", " si ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " No ", " no ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " El ", " el ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " Y ", " y ")
    tbxCustom1 = VBA.Replace(tbxCustom1, " Los ", " los ")
End Sub

Van a existir mas líneas por lo tanto quisiera pedirte si hacer cosa en que yo mas tarde pueda seguir agregando

1 respuesta

Respuesta
1

H o l a:

Te anexo la macro actualizada

Private Sub tbxCustom1_Change()
'Por.Dante Amor
    Dim ls()
    Dim i As Integer
    tbxCustom1 = Application.Proper(tbxCustom1)
    ls = Array("Al", "De", "Del", "La", "Se", "Si", "No", "El", "Y", "Los")
    For i = LBound(ls) To UBound(ls)
        tbxCustom1 = Replace(tbxCustom1, " " & ls(i) & " ", " " & LCase(ls(i)) & " ")
    Next
End Sub

sal u dos

Mejor no pdia estar

Gracias DAM, rápido y excelente

Si no te aparece la calificación, solo manda un grito y salgo corriendo a nueva pregunta

Gracias amigo, ya aparece.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas