|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
说明:
A列单元格中输入以空格分隔的单词。
当B列单元格为空时,光标选中即自动输出由10个任意个数单词的随机组合。
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- If Target.Count > 1 Then Exit Sub
- If Target.Column <> 2 Then Exit Sub
- If Target <> "" Or Target.Offset(, -1) = "" Then Exit Sub
-
- t = Split(Target.Offset(, -1) & " "): n = UBound(t)
- For i = 1 To 10
- s = t
- For j = 1 To Int(Rnd * n)
- s(Int(Rnd * n)) = ""
- Next
- ss = ss & "," & Application.WorksheetFunction.Trim(Join(s)) & " A"
- Next
- Target = Mid(ss, 2)
- End Sub
复制代码 |
-
-
1.rar
12.06 KB, 下载次数: 118
|