
Duda sobre codigo separcion cadena caracteres en VB
Publicado por Oscar (4 intervenciones) el 21/08/2021 23:28:29
Buenas, no termino de hacer funcionar este codigo para separacion de cadenas de caracteres. Os agradeceria algun comentario.
----------
Sub Cadenas()
x = 1
y = 1
While Cells(x, 1) <> ""
Surname = ""
Name = ""
For Each Item In Split(Cells(x, y))
If Asc(Mid(Item, 1, 1)) = Asc(UCase(Mid(Item, 1, 1))) And Asc(Mid(Item, 2, 1)) = Asc(UCase(Mid(Item, 2, 1))) Then
Surname = Surname & " " & Item
Else
Name = Name & " " & Item
End If
Next Item
Cells(x, 2) = Trim(Surname)
Cells(x, 3) = Trim(Name)
x = x + 1
Wend
End Sub
----------
Gracias por la ayuda,
----------
Sub Cadenas()
x = 1
y = 1
While Cells(x, 1) <> ""
Surname = ""
Name = ""
For Each Item In Split(Cells(x, y))
If Asc(Mid(Item, 1, 1)) = Asc(UCase(Mid(Item, 1, 1))) And Asc(Mid(Item, 2, 1)) = Asc(UCase(Mid(Item, 2, 1))) Then
Surname = Surname & " " & Item
Else
Name = Name & " " & Item
End If
Next Item
Cells(x, 2) = Trim(Surname)
Cells(x, 3) = Trim(Name)
x = x + 1
Wend
End Sub
----------
Gracias por la ayuda,
Valora esta pregunta


0