Có search được code của Kutool.
Hàm Random anh ndu
Cái này ứng dụng được cùng cái random của anh ndu thì khỏi phải xuất ra sheets.
PHP:
Sub GetString()
'Updateby Extendoffice
Dim xStr As String
Dim FRow As Long
Dim xScreen As Boolean
xScreen = Application.ScreenUpdating
Application.ScreenUpdating = False
xStr = Application.InputBox("Enter text to permute:", "Kutools for Excel", , , , , , 2)
If Len(xStr) < 2 Then Exit Sub
If Len(xStr) >= 8 Then
MsgBox "Too many permutations!", vbInformation, "Kutools for Excel"
Exit Sub
Else
ActiveSheet.Columns(1).Clear
FRow = 1
Call GetPermutation("", xStr, FRow)
End If
Application.ScreenUpdating = xScreen
End Sub
Sub GetPermutation(Str1 As String, Str2 As String, ByRef xRow As Long)
Dim i As Integer, xLen As Integer
xLen = Len(Str2)
If xLen < 2 Then
Range("A" & xRow) = Str1 & Str2
xRow = xRow + 1
Else
For i = 1 To xLen
Call GetPermutation(Str1 + Mid(Str2, i, 1), Left(Str2, i - 1) + Right(Str2, xLen - i), xRow)
Next
End If
End Sub
Hàm Random anh ndu
PHP:
Function UniqueRandomNum(Bottom As Long, Top As Long, Amount As Long)
'Application.Volatile '<--- Neu muon gia tri thay doi khi bam F9
On Error Resume Next
If Amount > Top - Bottom + 1 Then Amount = Top - Bottom + 1
With CreateObject("Scripting.Dictionary")
Do
.Add Int(Rnd() * (Top - Bottom + 1)) + Bottom, ""
Loop Until .Count = Amount
UniqueRandomNum = WorksheetFunction.Transpose(.Keys)
End With
End Function
Cái này ứng dụng được cùng cái random của anh ndu thì khỏi phải xuất ra sheets.