Option Explicit
Function RandomFromList(PassList As String) As String
Application.Volatile
'Создаем массив, в котором будем хранить слова
Dim Words() As String
'делит строки на слова используя пробел в качестве разделителя
Words = Split(PassList, ",")
' Получаем случайную часть
Dim Low As Integer
Low = 0 '<<< CHANGE AS DESIRED
Dim High As Integer
High = (UBound(Words)) '<<< CHANGE AS DESIRED
Dim R As Integer
R = (High - Low) * Rnd() + Low
RandomFromList = Words(R)
End Function

 

Advertisements