如图,C2公式:
=LARGE(IF(COUNTIF(c$1:c1,ROW($1:$30))=0,ROW($1:$30)),RANDBETWEEN(1,31-ROW(a1)))
数组公式,CTRL+SHIFT+回车,下拉;
Dim A() As String
Private Sub BEG_Click()
Timer1Enabled = True
If BEGCaption = "开始抽签" Then
BEGCaption = "停止"
Else
BEGCaption = "开始抽签"
Timer1Enabled = False
End If
End Sub
Private Sub ADD_Click()
Dim STR As String
STR = InputBox("请输入要增加的名字")
Dim conn As New ADODBConnection
Dim rs As New ADODBRecordset
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Str1 = "Provider=MicrosoftJetOLEDB40;"
Str2 = "Data Source=C:\Documents and Settings\Administrator\桌面\DB2MDB;"
Str3 = "Jet OLEDB:Database Password="
connOpen Str1 & Str2 & Str3
strSQL = "select from 表1 "
rsOpen strSQL, conn, 3, 3
rsAddNew
rs!名字 = STR
rsUpdate
rsClose
connClose
End Sub
Private Sub Form_Load()
Timer1Enabled = False
Dim conn As New ADODBConnection
Dim rs As New ADODBRecordset
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Str1 = "Provider=MicrosoftJetOLEDB40;"
Str2 = "Data Source=C:\Documents and Settings\Administrator\桌面\DB2MDB;"
Str3 = "Jet OLEDB:Database Password="
connOpen Str1 & Str2 & Str3
strSQL = "select from 表1 "
rsOpen strSQL, conn, 3, 3
TEM = rsRecordCount
rsClose
For I = 1 To TEM
strSQL = "select from 表1 where 编号=" & I & ""
rsOpen strSQL, conn, 3, 3
ReDim Preserve A(0 To I)
A(I) = rs!名字
rsClose
Next I
connClose
End Sub
Private Sub Timer1_Timer()
Static J As Integer
Text1Text = A(J)
J = J + 1
If J = UBound(A) Then
J = 1
End If
End Sub
代码以及运行过,你现在桌面上建立一个名为db2的数据库,一个字段“名字”
可以偷懒的嘛!
用记事本把下面代码保存为XXbat 双击运行即可
@echo off&color 3e&mode con cols=55
set nab=1-54
title 不重复随机抽取 %nab%
echo/
echo ==========================
echo/
echo 抽 签 开 始 啦 !
echo/
echo ^( %nab% ^)
echo ==========================
echo/
echo 请输入一名字后回车或直接回车进行抽签,
echo/&echo 中止抽签请按 q 回车:&echo/
setlocal enabledelayedexpansion
set nbn=%nab:-=%
call set nb0=%%nab:-!nbn!=%%
(for /L %%s in (%nb0%,1,%nbn%)do (
call :geths
set !hs!=%%s&echo!hs!
))>temyky
for /f %%r in ('type temyky^|sort')do (
set w=&set/p w=
if /i "!w!"=="q" goto :end
set/a n+=1
echo 第 !n! 个抽的是: !%%r!)
:end
del temyky
echo/&echo 抽签完毕! 按任意键退出
pause>nul&exit
:geths
set hs=%random%
if defined %hs% goto geths
以上就是关于急求一个EXCEL抽签程序(1到30号),主要用于演讲比赛抽签,但是不能到现场抽签的人,不要重复,谢谢全部的内容,包括:急求一个EXCEL抽签程序(1到30号),主要用于演讲比赛抽签,但是不能到现场抽签的人,不要重复,谢谢、求一个抽签的VB程序,能把名字写入数据库,又能运行抽签 源代码请发cht3068@sina.com、求一个随机抽签不重复软件或.exe程序,1-54之间不重复。哪位能帮忙谢谢!等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)