Funci贸 Right

Torna els car脿cters m茅s a la dreta de "n" d'una expressi贸 de cadena.

Vegeu tamb茅: Funci贸 Left.

Sintaxi:


Right (string As String, length As Long)

Valor de retorn:

Cadena

Par脿metres:

string: Any string expression that you want to return the rightmost characters of.

length: Numeric expression that defines the number of characters that you want to return. If length = 0, a zero-length string is returned. The maximum allowed value is 2,147,483,648.

L'exemple seg眉ent converteix una data en format YYYY-MM-DD al format de data dels EUA (MM/DD/YYYY).

Codis d'error

5 La crida al procediment no 茅s v脿lida

Exemple:


Sub ExampleUSDate
Dim sInput As String
Dim sUS_date As String
    sInput = InputBox("Introdu茂u una data en el format internacional 'YYYY-MM-DD'")
    sUS_date = Mid(sInput, 6, 2)
    sUS_date = sUS_date & "/"
    sUS_date = sUS_date & Right(sInput, 2)
    sUS_date = sUS_date & "/"
    sUS_date = sUS_date & Left(sInput, 4)
    MsgBox sUS_date
End Sub

Ens cal la vostra ajuda!