Advertisement
Otsukare-Sama

Untitled

Nov 1st, 2023 (edited)
999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VisualBasic 0.60 KB | Source Code | 0 0
  1. Function GetFirstLetters(rng As Range) As String
  2.    Dim arr
  3.    Dim I As Long
  4.    arr = VBA.Split(rng, " ")
  5.    If IsArray(arr) Then
  6.        For I = LBound(arr) To UBound(arr)
  7.            GetFirstLetters = GetFirstLetters & Left(arr(I), 1)
  8.        Next I
  9.    Else
  10.        GetFirstLetters = Left(arr, 1)
  11.    End If
  12. End Function
  13.  
  14. ' Questa funzione suddivide il testo in input in parole (usando lo spazio come delimitatore e se necessario) e restituisce le prime lettere di ciascuna parola come una singola stringa.
  15. ' Se il testo in input è una sola parola, restituirà la prima lettera di quella parola.
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement