|
发表于 2015-11-1 10:15
|
显示全部楼层
本楼为最佳答案
- Sub text()
- Dim str$, d, w%, g%, m%, x%, s$
- Set d = CreateObject("scripting.dictionary")
- str = Range("D2").Value
- w = Range("A2").Value
- g = Range("B2").Value
- Range(Range("C2").Value).Resize(99, 1).Clear
-
- Do
- For m = 1 To w
- x = Int(Rnd * Len(str)) + 1
- s = s & Mid(str, x, 1)
- Next m
- d(s) = s
- s = ""
- Loop While d.Count < g
- Range(Range("C2").Value).Resize(g, 1).NumberFormatLocal = "@"
- Range(Range("C2").Value).Resize(g, 1) = Application.Transpose(d.keys)
- End Sub
复制代码 |
|