Spajanje nizova koji se nalaze u ćelijama A1, A2, A3, A4 vršim na jedan od dva načina, il pomoću funkcije Concatenate il uz pomoć ampresend-a (&). Oni se spoje u onom redosledu u kojem ja to odlučim npr. ako napišem =A1&A2&A3&A4 on na niz iz ćelije A1 nadoveže niz iz A2 pa na njega iz A3 itd. Interesuje me da li postoji neka funkcija (slično kako radi RAND) tako da kad pritisnem F9 da on nizove nadovezuje nasumično, npr. na A4 da ide A3 pa A1 itd. svaki put drugačije. Nadam se da ste shvatili šta mi treba.
Nasumično spajanje nizova
Zaključano
Zakačeno
Il ako neko zna ne mora biti sadržaj ćelija može npr. kao ="a"&"b"&"c" da on ispisuje različite kombinacije abc, bca, cab...
Pogledaj macro od M.Larson za kreiranje permutation (P)
ili probaj iskoristititi ovaj macro
ili probaj iskoristititi ovaj macro
Code:
Sub GetString()
Dim InString As String
InString = InputBox("Enter text to permute:")
If Len(InString) < 2 Then Exit Sub
If Len(InString) >= 8 Then
MsgBox "Too many permutations!"
Exit Sub
Else
ActiveSheet.Columns(1).Clear
CurrentRow = 1
Call GetPermutation("", InString)
End If
End Sub
Sub GetPermutation(x As String, y As String)
' The source of this algorithm is unknown
Dim i As Integer, j As Integer
j = Len(y)
If j < 2 Then
Cells(CurrentRow, 1) = x & y
CurrentRow = CurrentRow + 1
Else
For i = 1 To j
Call GetPermutation(x + Mid(y, i, 1), _
Left(y, i - 1) + Right(y, j - i))
Next
End If
End Sub
Sub GetString()
Dim InString As String
InString = InputBox("Enter text to permute:")
If Len(InString) < 2 Then Exit Sub
If Len(InString) >= 8 Then
MsgBox "Too many permutations!"
Exit Sub
Else
ActiveSheet.Columns(1).Clear
CurrentRow = 1
Call GetPermutation("", InString)
End If
End Sub
Sub GetPermutation(x As String, y As String)
' The source of this algorithm is unknown
Dim i As Integer, j As Integer
j = Len(y)
If j < 2 Then
Cells(CurrentRow, 1) = x & y
CurrentRow = CurrentRow + 1
Else
For i = 1 To j
Call GetPermutation(x + Mid(y, i, 1), _
Left(y, i - 1) + Right(y, j - i))
Next
End If
End Sub