1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Option Explicit
Public Function SCRAMBLE(sCellContents As String) As String Dim itextlength As Integer Dim ichar As Integer Dim irandomposition As Integer Dim scharacter As String * 1
itextlength = Len(sCellContents) For ichar = 1 To itextlength scharacter = VBA.Mid(sCellContents, ichar, 1) irandomposition = VBA.Int((itextlength - 1 + 1) * VBA.Rnd + 1) Mid(sCellContents, ichar, 1) = VBA.Mid(sCellContents, irandomposition, 1) Mid(sCellContents, irandomposition, 1) = scharacter Next ichar SCRAMBLE = sCellContents End Function
|